裝了那麼多次 mysql 在 ubuntu 上第一次遇到這個問題。
裝的時候裝了 mysql-server mysql-dev
為了加強安全性會輸入 sudo mysql_secure_installation
只是要你改root密碼時就算密碼強度是 100 他還是會跳錯誤
Failed! Error: SET PASSWORD has no significance for user ‘root’@’localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.
請支持《Sectools.tw》原創文章。原文標題:Ubuntu 20.04 how to solve SET PASSWORD has no significance for user ‘root’@’localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. ,原文網址:https://sectools.tw/ubuntu-20-04-how-to-solve-set-password-has-no-significance-for-user-rootlocalhost-as-the-authentication-method-used-doesnt-store-authentication-data-in-the-mysql-server/
基本上可能跟密碼原本是空而且是 mysql_native_password
解決辦法是
先登入 mysql 更改 root 密碼
sudo mysql
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password by ‘newpassword’;
exit
sudo mysql_secure_installation
接下來就正常囉
