解決Linux下普通用戶無法使用root連接MySQL服務

最近在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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章