MySQL root密码重置

1.停止MySQL进程

service mysqld stop

2.进入MySQL程序目录

cd /usr/local/mysql/bin

3.以安全模式启动MySQL

./mysqld_safe --skip-grant-tables

4.新打开一个终端窗口,登录到MySQL

mysql -uroot

5.清空密码

update mysql.user set authentication_string=PASSWORD('你的密码') where User='root';

FLUSH PRIVILEGES;

6.重设密码

set password=password('123456');

原文地址:https://www.cnblogs.com/wangshuyi/p/6571701.html