升級的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,密碼更新成功,親測有效!
