参考资料:http://www.javashuo.com/article/p-cdixfltl-ca.htmlhtml
解决方法:mysql
1、经过编辑/etc/my.cnf文件在[mysqld]下面加上skip-grant-tables=1,保存退出;sql
2、重启MySql服务【systemctl restart mysqld.service】;数据库
3、以root身份登陆MySql【mysql -u root】;spa
4、进入mysql数据库【mysql> use mysql;】;rest
5、修改root密码:code
mysql> update user set authentication_string = password('新密码'),password_last_changed=now() where user='root';
6、退出mysql,再次编辑/etc/my.cnf文件,将第一步中添加的skip-grant-tables=1删掉,重启启动MySql服务便可。htm