2019-09-29 MySQL忘记密码解决方案

2019-09-29  本文已影响0人  柒李香
时光流转

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退出

6、启动mysql服务并登录

net start mysql
mysql -uroot -p123456

修改成功

上一篇 下一篇

猜你喜欢

热点阅读