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
7.修改root本地登录密码
查看临时密码
grep 'temporary password' /var/log/mysqld.log
登陆数据库(使用上面的临时密码)
mysql -uroot-p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY'new password';
***
这样就完成了MySQL在centos下的安装