原因
未开启密码校验插件。
查看设置
查看变量中是否有密码校验。
SHOW VARIABLES LIKE 'validate_password%';
查看插件中是否有校验类插件。
select plugin_name, plugin_status from information_schema.plugins where plugin_name like 'validate%';
返回空集合
mysql> SHOW VARIABLES LIKE 'validate_password%';
Empty set (0.00 sec)
mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like 'validate%';
Empty set (0.00 sec)
解决方法
安装插件(在MySQL shell中)
install plugin validate_password soname 'validate_password.so';
查看是否安装成功。
mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like 'validate%';
+-------------------+---------------+
| plugin_name | plugin_status |
+-------------------+---------------+
| validate_password | ACTIVE |
+-------------------+---------------+
1 row in set (0.01 sec)
查看相关变量。
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| 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 |
+--------------------------------------+--------+
7 rows in set (0.00 sec)