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