天天看點

Mysql5.7忘記登入密碼解決方法

1.進入Mysql安裝路徑,修改my.ini檔案:

Mysql5.7忘記登入密碼解決方法

2.在[mysqld] 下面添加 skip-grant-tables ,儲存退出。

Mysql5.7忘記登入密碼解決方法

3.按WIN+R快捷鍵,打開運作界面,輸入services.msc指令

Mysql5.7忘記登入密碼解決方法

4.運作cmd,輸入mysql -u root -p,這時候提示你輸入密碼,直接回車就可以進入。

Mysql5.7忘記登入密碼解決方法

5.進入mysql資料庫,use mysql;

Mysql5.7忘記登入密碼解決方法

6.給root使用者設定新密碼:update user set authentication_string = password("123456") where user="root" ;

Mysql5.7忘記登入密碼解決方法

如果是Mysql5.7以下版本使用:update user set password=password("123456") where user="root";

7.重新整理資料庫: flush privileges;

Mysql5.7忘記登入密碼解決方法

8.退出資料庫: quit; 

重新連接配接資料庫,輸入密碼,OK!

繼續閱讀