mysql8.0.18忘记密码问题
-
管理员身份进入dos
-
停止mysql服务
net stop mysql
-
无密码启动
C:\Windows\System32>D:\mysql-8.0.18-winx64\bin\mysqld --console --skip-grant-tables --shared-memory
-
另启一个dos窗口,无密码登录
C:\Windows\System32>D:\mysql-8.0.18-winx64\bin\mysql -u root
-
清空密码
注意:authentication_string采用的是plugin加密方式,故设置为空,不要设置为其他值
mysql> UPDATE mysql.user SET authentication_string=’’ WHERE user=‘root’;
-
启动服务
关闭打开的两个dos窗口,然后以管理员身份重新打开一个dos窗口,启动服务
net start mysql -
无密码登录
C:\Windows\System32>D:\mysql-8.0.18-winx64\bin\mysql -u root -
重新设置密码
alter user root@localhost identified by ’root’; -
新密码登录
C:\Windows\System32>D:\mysql-8.0.18-winx64\bin\mysql -u root -proot
————————————————
原文链接:https://blog.csdn.net/Evanzzxcw/article/details/102795361