wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server --nogpgcheck
sudo chown -R root:root /var/lib/mysql
vim /etc/my.conf 在文件末尾加一行skip-grant-tables
如果你手气不好,可能没有my.conf,那就是my.cnf
service mysqld restart
mysql -u root
use mysql;
select*from user\G;
update user set authentication_string=password("新密码") where user="root";
flush privileges;
quit