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');

 

相关文章:

  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-11-07
猜你喜欢
  • 2021-09-12
  • 2021-07-31
  • 2021-05-29
  • 2021-11-21
  • 2022-01-27
  • 2022-01-08
相关资源
相似解决方案