MySQL 忘记密码解决方案

1、管理员身份打开命令行

net stop mysql

2、跳过用户验证

  mysqld --skip-grant-tables 

3、管理员身份打开新窗口,输入

mysql

image.png

4、进入mysql数据库

use mysql;

5、重新设置密码

update user set password=password('123456') where user='root' and host='localhost';

如果出现以下错误,则将命令改为

update user set authentication_string=password('123456') where user='root' and host='localhost';

修改后exit退出
image.png

6、启动mysql服务并登录

net start mysql
mysql -uroot -p123456

image.png

修改成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章