1、wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、yum -y install mysql57-community-release-el7-10.noarch.rpm
3、yum -y install mysql-community-server
4、systemctl start mysqld.service
5、systemctl status mysqld.service查看一下
Active: active (running) since Mon 2021-07-19 14:55:32 CST; 30s ago
6、grep "password" /var/log/mysqld.log查看密码
2021-07-19T06:55:26.183105Z 1 [Note] A temporary password is generated for root@localhost: &>J)Xk#kv6.9
7、mysql -uroot -p&>J)Xk#kv6.9
8、ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
这个new password需要有大小写特殊字符加数字
select user,authentication_string,host from user;
grant all privileges on *.* to 'root'@'%' identified by 'new password';
flush privileges;
9、yum -y remove mysql57-community-release-el7-10.noarch卸载掉这个Yum Repository
10、systemctl stop firewalld关闭防火墙
11、systemctl start firewalld.service启动防火墙
12、firewall-cmd --permanent --zone=public --add-port=3306/tcp如果提示success说明ok了。
参考: