1、直接拉官网安装包

1、wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
2、rpm -ivh mysql-community-release-el7-5.noarch.rpm
3、yum install mysql-community-server

2、成功安装之后重启mysql服务

systemctl restart mysqld

3、设置密码

mysql -uroot
mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
mysql> exit