mysql5.7 修改root密碼無法登陸原因


升級的mysql5.7修改完root賬戶密碼后仍然無法登陸,查閱資料可能和user表的plugin 字段為空有關。

1、首先將my.ini中加入在[mysqld]節點上加skip-grant-tables
主要作用是:跳過表中的驗證,可以無密碼登陸。

2、登錄之后查詢plugin字段值:

mysql> select plugin from user where user = 'root';

執行結果plugin字段為空。

3、更新plugin字段為mysql默認值:

mysql> update user set plugin='mysql_native_password';

查詢更新結果:


4、更新成功,繼續執行更新密碼操作:

mysql> update user set authentication_string=password('123456') where user='root' and host='localhost';

5、刷新權限:

mysql> flush privileges;

6、將my.ini中的skip-grant-tables注釋掉或者刪掉

重啟mysql,密碼更新成功,親測有效!

 

原地址:https://blog.csdn.net/xyajia/article/details/76746883


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM