在配置文件中添加: skip-grant-tables
service mysqld restart
mysql
use mysql;
update user set password=PASSWORD('123456') where user='root';
flush privileges;
在配置文件中删除掉: skip-grant-tables
service mysqld restart
本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1892324