1.关闭服务器,要管理员打开 cmd
net stop mysql
2.进入 到mysql\bin中。跳过密码
mysqld --console --skip-grant-tables --shared-memory
3.新打开一个窗口
mysql -u root -p
密码不输入,直接回车
4.修改密码为空
use mysql;
update user set authentication_string='' where user='root';
select host,user,authentication_string from mysql.user;
5.上面把密码修改成空了,此时关闭所有的窗口
再启动服务 net start mysql
修改密码
use mysql
update user set authentication_string='123456' where user='root';
flush privileges;
如果出现 navicate连接错误,可能是密码方式不对,这里修改下密码
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
搞定
本文详细描述了如何在Windows系统中通过命令行关闭MySQL服务,跳过密码验证,临时修改root用户密码,以及修复navicate连接错误的过程。
4430

被折叠的 条评论
为什么被折叠?



