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

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

sh mysql80.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 8.0

添加yum安装源

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

https://raw.githubusercontent.com/yunweibang/yum.repos.d/master/mysql80-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-80.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;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';

添加用户root@127.0.0.1,给用户授权,重要!重要!重要!

create user 'root'@'127.0.0.1' identified by 'your_password';

grant all privileges on *.* to 'root'@'127.0.0.1';

flush privileges;

重启MySQL

service mysqld restart

results matching ""

    No results matching ""