天天看點

ERROR 1819 (HY000) Your password does not satisfy the current policy requirements

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     |
+--------------------------------------+-------+
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)           

繼續閱讀