1.停止mysql进程

sudo killall -TERM mysqld

2.进入安全模式

mysqld_safe --skip-grant-tables&

3.修改密码

USE mysql;
UPDATE user SET password=password('新密码') WHERE user='root';
FLUSH PRIVILEGES;

4.启动mysql

sudo service mysqld restart

Post Navigation