Mysql modify password security level: ERROR 1819 (HY000) Your password does not satisfy the current policy requirements

phenomenon

Error occurs when operating password related commands in mysql

mysql> select password('admin');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

the reason

There are password verification rules in mysql, which can be viewed through commands

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)

Password verification is divided into three levels:

  1. 0 or LOW:约束 Length
  2. 1 or MEDIUM   :约束 Length; numeric, lowercase/uppercase, and special characters
  3. 2 or STRONG   :约束 Length; numeric, lowercase/uppercase, and special characters; dictionary file

Constraints include:

  • validate_password_policy: This parameter is used to control the validation policy of validate_password 0-->low 1-->MEDIUM 2-->strong.
  • validate_password_length: The minimum password length (the minimum value is 4).
  • validate_password_number_count: The minimum number of digits in the password.
  • validate_password_mixed_case_count: The minimum number of case.
  • validate_password_special_char_count: The minimum number of special characters.
  • validate_password_dictionary_file: dictionary file, only characters in the file

Treatment plan

Option One

Set password according to rules

Option II

Modify the rules, modify the response parameters according to the requirements, only modify the validate_password_policy invalid.

mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_number_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 4      |
| validate_password_mixed_case_count   | 0      |
| validate_password_number_count       | 0      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 0      |
+--------------------------------------+--------+
7 rows in set (0.01 sec)

mysql> select password('admin');
+-------------------------------------------+
| password('admin')                         |
+-------------------------------------------+
| *4ACFE3202A5FF5CF467898FC58AAB1D615029441 |
+-------------------------------------------+
1 row in set, 1 warning (0.00 sec)

 

Guess you like

Origin blog.csdn.net/lizz861109/article/details/112396920