$>: sudo mysql_secure_installationSecuring the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD COMPONENT can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD component?Press y|Y for Yes, any other key for No: yThere are three levels of password validation policy:LOW Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special characters and dictionary filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2Please set the password for root here.New password:Re-enter new password:Estimated strength of the password: 100Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y... 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.New password:.... 然後就一直重複
是新安裝時就遇到,我還試過把安裝的 mysql 完整移除後再重新來過,還是一樣…
後來在 stackoverflow: MySQL installation on Ubuntu 20.04 error when using mysql_secure_installation 找到解方。
解方步驟如下
- 先離開 mysql_secure_installation
- 以 root 身份(不是 mysql 的 root ,是系統的)或是進行 sudo mysql
- 此時會是以 mysql root 身份進入了 mysql
- 修改 mysql root 的認證是使用傳統的 mysql 原生密碼模式
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
- 此時等於是先一步設定 mysql root 密碼
- 然後離開 mysql
- 再執行 sudo mysql_secure_installation
- 此時因為前一步已設定 root 密碼了,所以這邊進入時會叫你先輸入 root 密碼
- 輸入完剛前一步預設好的密碼,接著,驗證密碼(validate_password)會先檢查你輸入的密碼的安全性…基本上低於 70 的好像就會要求你重設密碼
- 再來接著你選過密碼的強度來設定新的 mysql root 密碼
- 再來就不會像跟之前會一直重複在要「new password」了…
我個人猜測應該是一開始就預設了 mysql 認證的方式太過新或麻煩,因為有不少文章後來都說要把認證方式改為 mysql_native_password 了
但,或許在 sudo mysql_secure_installation 「Would you like to setup VALIDATE PASSWORD component?」就選 "n",可能還不會卡住。
沒有留言:
張貼留言