動かざることバグの如し

近づきたいよ 君の理想に

MySQL5.7のvalidate_passwordとかいうクソ機能殺す

発端

macMySQLインストールするぞい

brew install mysql

初期設定するぞい

mysql_secure_installation

片っ端から「y」でいくぞい!

$ mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 25 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :  

どうもMySQL5.7から緩いパスワードを受け付けない、「validate_password」とかいう機能が追加された模様。

先に進めない

解決策

セットアップではちゃんとしたパスワードを仮設定しておいてそのパスワードでまずはログイン

バリデーション機能が生きてると以下のように表示される

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

速攻削除

mysql> uninstall plugin validate_password;
mysql> SHOW VARIABLES LIKE 'validate_password%';
Empty set (0.00 sec)

やっためう!!

パスワードの設定記法も変わったってこマ?

死んでくれ頼む

set password for root@localhost = 'hogehoge';