MySQL 5.7在Windows环境下忘记root用户密码 如何找回

964 total views, 1 views today

1.停止MySQL服务

可以在“服务”中图形点击停止MySQL服务;也可以使用命令停止

net stop mysql

 

2.启动mysql服务,并加上参数–skip-grant-tables跳过授权表认证。

mysqld –skip-grant-tables

 

3.修改root密码

5.7 版本

update mysql.user set authentication_string=password(‘123456′) where user=’root’;

5.7之前版本:

update mysql.user set password=password(“123456”) where user=’root’;

 

4.去掉–skip-grant-tables参数,重启mysql服务

 

5.登录验证

发表评论

必填项已用*标注