進入mysql數據庫,修改數據庫的內容
1, use mysql;
2,update user set authentication_string="" where User='root';//設 authentication_string 為空值 ,因為是連接這個加密的東西
先設密碼為空
3,update user set plugin="mysql_native_password";
4,flush privileges;
5,quit;
然后重啟MySQL。
6,接着在命令行修改root用戶密碼,
mysqladmin -u root -p password
按提示重設密碼
ok。完美連接成功
--------------------------------------------------------分割線-----------------------------------------
以上mysqladmin 是window系統有的,Linux用不上,在MySQL5.7以上的版本,mysql的user表的密碼是authentication_string,不再是password
linux更改root密碼:update user set authentication_string=password("test") where User='root';//那個password 是必須要寫的,不然就進不去了數據庫。
flush privileges;