-1.MySQL GPG 密钥已过期,更新
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
0.清除 mysql 残留日志,不清除就不能完成第五步,生成新的 mysql 临时密码
rm -rf /var/log/mysqld.log
1.下载 rpm 包
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2.安装 rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
3.安装 mysql
yum -y install mysql-community-server
4.启动 mysql 服务
systemctl start mysqld.service
5.查看临时密码
grep "password" /var/log/mysqld.log
6.登录 mysql,输入刚获取到的临时密码
mysql -uroot -p
7.设置密码安全等级最低,可设置任意字符(可选)
set global validate_password_policy=0;
8.设置密码长度不限,可设置任意长度(可选)
set global validate_password_length=1;
9.修改mysql密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码';
10.开启mysql远程连接
use mysql;
select host from user where user='root';
update user set host = '%' where user ='root';
flush privileges;