Windows下MySQL忘记密码

当忘记MySQL密码,怎么办捏?在MySQL环境下进行一下操作:

1.编辑my.ini文件

我是通过免安装版配置的MySQL,在MySQL安装目录下有my.ini的文件,在此文件中添加:

skip-grant-tables #表示忽略密码
2.重启MySQL服务
3.修改密码

例如:

update mysql.user set authentication_string=password('123456789') where user='root' and host = 'localhost';
flush privileges
quit
4.修改my.ini

将my.ini中,第1步添加的东西注释掉/或者删除

5.重启MySQL服务即可

猜你喜欢

转载自blog.csdn.net/qq_26710805/article/details/80178362