Linux---MySQL密碼找回方式高級版

上篇博文介紹了關於MySQL中的root密碼忘記的情況下如何找回,可是樓主遇到更無語的是使用—skip-grant-tables選項來啓動MySQL服務後,準備修改密碼時卻發現User表爲空,i_f06.gif

update user set Password=password('newpassword') where User='root’;

輸入修改密碼後得到

0 rows affected rows 
matched :0 changed:0

真是蛋疼無比,那還改個毛毛啊!!!i_f06.gifi_f06.gif

有網友說創建root並賦予權限

grant all on *.* to root@'localhost' identified by 'password';
grant all on *.* to root@'%' identified by 'password';

但是然並卵啊,使用—skip-grant-tables登錄之後,創建用戶提示錯誤啊,提示在—skip-grant-tables無法創建用戶。

樓主徹底崩潰!!!i_f06.gifi_f06.gifi_f06.gif

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement


後來試了下flush privileges 一下,

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)


ok,再執行添加root用戶就可以了,查詢User表發現裏面已經有數據了,哈哈,搞定,繼續修改密碼,重啓生效i_f27.gif

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章