最近在Ubuntu18.04上安裝了MySQL5.7.0版本的數據庫,按照常規步驟處理完成時候發現使用普通用戶(我的是Blue)執行mysql -uroot -p
即使密碼正確也是連接失敗的,因此你可能需要以下操作...
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;
重啓一下數據庫服務:
sudo systemctl restart mysql