最近在Ubuntu18.04上安裝了MySQL5.7.0版本的數據庫,按照常規步驟處理完成時候發現使用普通用戶(個人是Blue)執行mysql -uroot -p
即便密碼正確也是鏈接失敗的,所以你可能須要如下操做...mysql
use mysql; select user, plugin from mysql.user; select @@validate_password_length; set global validate_password_length=6; update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root'; select @@validate_password_length; select user, plugin from mysql.user; flush privileges;
重啓一下數據庫服務:sql
sudo systemctl restart mysql