這是我遇到的問題
然后就想這可能是mysql安全模式的問題,解決思路:首先改變mysql的安全模式及密碼校驗問題,進入mysql后在更改用戶名密碼。
1、首先將my.ini中加入在[mysqld]節點上加skip-grant-tables 也可能是my.cnf
主要作用是:跳過表中的驗證,可以無密碼登陸。
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,密碼更新成功,親測有效!