企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# **安装MySQL 8.0(推荐)** #### **一、脚本安装** ``` wget -O mysql80.sh http://www.bigops.com/bigops-install/mysql80.sh bash mysql80.sh ``` 按安装提示输入相关安装信息。 #### **二、优化配置** 修改/etc/my.cnf里innodb\_buffer\_pool\_size的值,innodb\_buffer\_pool\_size设置为剩余内存的70%到80%。 修改完后需要重启MySQL。 注意:如果是分布式安装,还需要在work机器上安装mysql client 添加yum安装源 ``` wget -O /etc/yum.repos.d/mysql80-community.repo http://www.bigops.com/yum.repos.d/mysql80-community.repo ``` 安装MySQL Client ``` yum -y install mysql-community-client mysql-community-devel mysql-community-libs-compat ``` #### **三、配置数据库** 取消密码复杂度,有的小版本有,有的小版本没这些变量,没有就忽略。 ``` set global validate_password.policy=0; set global validate_password.mixed_case_count=0; set global validate_password.number_count=0; set global validate_password.special_char_count=0; set global validate_password.length=6; ``` 修改密码。例如:修改root@localhost密码,your\_password改成你的密码。 ``` use mysql; ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password' PASSWORD EXPIRE NEVER; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'; flush privileges; ``` 添加用户。例如:添加root@127.0.0.1,your\_password改成你的密码。 ``` create user 'root'@'127.0.0.1' identified by 'your_password'; grant all privileges on *.* to 'root'@'127.0.0.1'; flush privileges; ``` 重启和查看MySQL运行状态 ``` systemctl restart mysqld systemctl status mysqld -l ``` # **安装MySQL 5.7** #### **一、脚本安装** ``` wget -O mysql57.sh http://www.bigops.com/bigops-install/mysql57.sh bash mysql57.sh ``` 按安装提示输入相关安装信息。剩下几步和MySQL8操作一样,步骤略。修改密码和添加用户略有不同。 修改密码。例如:修改root@localhost密码,your\_password改成你的密码。 ``` use mysql; grant all privileges on *.* to "root"@"localhost" identified with mysql_native_password by "your_password"; flush privileges; ``` 添加用户。例如:添加root@127.0.0.1用户,your\_password改成你的密码。 ``` grant all privileges on *.* to "root"@"127.0.0.1" identified with mysql_native_password by "your_password"; flush privileges; ```