1.下载 mysql源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2.安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3,检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
4.安装Mysql
yum install mysql-community-server
5.启动mysql
systemctl start mysqld
6.设置开机启动
systemctl enable mysqld
systemctl daemon-reload
8.修改root本地登录密码
1)查看mysql初试密码
grep 'temporary password' /var/log/mysqld.log
2)连接mysql
mysql -uroot -p
输入第一步获取的那个密码
3)修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Newpassword';
或者
set password for 'root'@'localhost'=password('Newpassword');
可能会出现下面的错误
Your password does not satisfy the current policy requirements