上篇博文介紹了關於MySQL中的root密碼忘記的情況下如何找回,可是樓主遇到更無語的是使用—skip-grant-tables選項來啓動MySQL服務後,準備修改密碼時卻發現User表爲空,
update user set Password=password('newpassword') where User='root’;
輸入修改密碼後得到
0 rows affected rows matched :0 changed:0
有網友說創建root並賦予權限
grant all on *.* to root@'localhost' identified by 'password'; grant all on *.* to root@'%' identified by 'password';
但是然並卵啊,使用—skip-grant-tables登錄之後,創建用戶提示錯誤啊,提示在—skip-grant-tables無法創建用戶。
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)