(推荐)方法一:脚本安装MySQL 5.7

wget -O mysql57.sh https://raw.githubusercontent.com/yunweibang/bigops-install/master/mysql57.sh

sh mysql57.sh

看到下面提示,输入root@127.0.0.1用户密码,保存好一会使用。另外root@localhost密码为空

please input root@127.0.0.1 password, default bigops

>输入你的密码

优化MySQL,修改/etc/my.cnf里innodb_buffer_pool_size的值,用命令计算:

说明:BigOps系统占用4G,所以innodb_buffer_pool_size等于总内存减去4G后的70%到80%

free -g|egrep -i ^mem|awk '{if($2<7) print "memory is too small";else print int(($2-4)*0.8)"G"}'

比如上面命令返回8G,就这样设置:

innodb_buffer_pool_size=8G

修改完后需要重启MySQL

方法二:手动安装MySQL 5.7

添加yum安装源

wget -O /etc/yum.repos.d/mysql-community.repo

https://raw.githubusercontent.com/yunweibang/yum.repos.d/master/mysql-community.repo

安装MySQL

yum -y install mysql-community-server mysql-community-client mysql-community-devel mysql-community-libs-compat

优化的配置文件

wget -O /etc/my.cnf https://raw.githubusercontent.com/yunweibang/bigops-install/master/mysql/my-57.cnf

chown -R mysql:mysql /var/lib/mysql

优化MySQL,修改/etc/my.cnf里innodb_buffer_pool_size的值,用命令计算:

说明:BigOps系统占用4G,所以innodb_buffer_pool_size等于总内存减去4G后的70%到80%

free -g|egrep -i ^mem|awk '{if($2<7) print "memory is too small";else print int(($2-4)*0.8)"G"}'

比如上面命令返回8G,就这样设置:

innodb_buffer_pool_size=8G

修改完后需要重启MySQL

初始化目录,会丢失以前的数据,确认当前数据是否有用,再进行操作

mysqld --user=mysql --lower-case-table-names=0 --initialize-insecure

root默认口令为空。如果启动失败,有可能basedir有以前的残留文件,需要删除。

登录MySQL

mysql -uroot -p

取消密码复杂度,有的小版本有,有的小版本没这些变量,没有就忽略

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;

grant all privileges on *.* to "root"@"localhost" identified with mysql_native_password by "your_password";

添加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;

重启MySQL

service mysqld restart

results matching ""

    No results matching ""