环境
mysql> select version();
+
| version() |
+
| 8.0.16 |
+
报错
创建用户的时候报错
create user 'user1'@'%' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
原因
密码设置的过于简单
解决:
修改密码的验证策略
mysql> SHOW VARIABLES LIKE 'validate_password%';
+
| Variable_name | Value |
+
| validate_password.check_user_name | ON |
| 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.03 sec)
mysql> set global validate_password.policy = 0;
mysql> set global validate_password.length = 4;
mysql> SHOW VARIABLES LIKE 'validate_password%';
+
| Variable_name | Value |
+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 4 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+
成功
mysql> create user 'user1'@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
参考 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
|