ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
mysql> create user 'test1'@'localhost' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
原因:密码策略问题
解决办法:
1.查看mysql初始的密码策略
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 |
+--------------------------------------+-------+
//代码效果参考:http://www.zidongmutanji.com/bxxx/451386.html
7 rows in set (0.00 sec)
2.设置密码的验证强度等级,设置validate_password_policy的全局参数为LOW
(修改为low后,就只验证密码的长度)
mysql> set global validate_password_policy=LOW;
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 | LOW |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
3.修改密码长度
mysql> set global validate_password_length=6;
mysql> show variables like 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 6 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.01 sec)
4.验证
mysql> create user 'test1'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.06 sec)