1、获取RPM源文件
2、下载需要的版本文件
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
3、yum加载配置文件
yum localinstall mysql57-community-release-el7-8.noarch.rpm
4、安装
yum install mysql-community-server
5、查看启动服务
systemctl status mysqld
systemctl start mysqld
6、查找安装时随机产生的密码
grep 'temporary password' /var/log/mysqld.log
7、登录
mysql -u root -pEiR73KF,dGYl
8、设置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'EiR73KF,dGYl';
set password for 'root'@'localhost'=password('Niubi1234/');
9、授权远程访问
grant all on *.* to 'root'@'%' identified by 'Niubi1234/';
10、重启mysql
systemctl restart mysqld
11、开启防火墙端口
firewall-cmd --add-port=3306/tcp --permanent
systemctl restart firewalld.service
12、连接测试