先将mysql安装bin目录(例如:c:xxx\xxx\mysql\bin  加入环境变量)

1、在命令行窗口下输入net stop mysql5 或 net stop mysql

2、开一个命令行窗口,然后输入
mysqld -nt --skip-grant-tables;

3、再开一个DOS窗口,mysql -u root

4、输入:

 代码如下:

use mysql
update user set password=password("new_pass") where user="root";
flush privileges;
exit


5、使用任务管理器,找到mysqld-nt的进程,结束进程

然后再在命令行窗口输入:mysql -u root -p  回车

输入刚才设置的密码,发现已经可以进去了。

 

相关文章:

  • 2022-12-23
  • 2021-05-21
  • 2021-09-11
  • 2021-11-22
  • 2022-12-23
  • 2021-09-16
  • 2022-02-27
  • 2022-03-01
猜你喜欢
  • 2022-12-23
  • 2022-02-10
  • 2021-09-25
  • 2021-12-17
  • 2021-07-21
  • 2021-12-13
  • 2021-04-25
相关资源
相似解决方案