下载yum repo https://dev.mysql.com/downloads/repo/yum/
下载之后默认是8.0,切换到5.7
shell> yum repolist all | grep mysql
shell> sudo yum-config-manager --disable mysql80-community
shell> sudo yum-config-manager --enable mysql57-community
如果命令不存在,安装yum-utils
yum install mysql-community-server
安装好后设置基本配置在vim /etc/my.cnf
启动mysql服务systemctl start mysqld
启动后初始化可以使用命令grep 'temporary password' /var/log/mysqld.log获取
修改初始化密码(必须要修改初始化密码) ,首先需要降低密码策略
set global validate_password_policy=0;
set global validate_password_length=6;
接下来就可以修改密码了alter user root@localhost identified by '123456'
远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;