进去mysql里设置root密码
mysql> update mysql.user set authentication_string=password(‘123456‘) where user=‘root‘ ;
Query OK, 1 row affected, 1 warning (0.09 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> exit
Bye
[root@mha ~]# vi /etc/my.cnf ###进去把skip-grant-tables注释了
[root@mha ~]# systemctl restart mysqld
原文:http://blog.51cto.com/wsw26/2063654