MySQL忘记密码

来源:互联网 发布:http 文件 json 上传 编辑:程序博客网 时间:2024/06/16 05:27

1.停止mysql服务

2.打开cmd命令行进入mysql.exe和myqld.exe所在的文件夹

cd D:\Program Files\MySQL\MySQL Server 5.7\bin

3.执行命令跳过mysql的用户验证(注意:在输入此命令之前确保mysqld.exe已经没有运行)

mysqld --skip-grant-tables

4.重新开一个命令行窗口,登录mysql(由于执行上面命令后,命令行就无法操作了)

mysql -uroot -p123456

5.修改mysql密码

update mysql.user set authentication_string=password('123456') where user='root' and Host='localhost';

6.重新启动mysql服务

原创粉丝点击