Linux (error 1819 (HY000): your password does not satisfy the current policy requirements)

problem ERROR 1819 (HY000): Your password does not satisfy the current policy requirements. To enhance security, MySQL5.7 randomly generated a password for root user. In the error log, regarding the location of the error log, if the RPM package is installed, the default is /var/log/mysqld.log.

can generally be set by log_error

obtain temporary password of MySQL by # grep "password" /var/log/mysqld.log command
2016-01-19T05:16:36.218234Z 1 [Note] A temporary password is generated for root@localhost: WaQ,qR%be2(5

mysql> select user();
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

If

is simply changed to a simple password, the following error is reported:

mysql> ALTER USER USER() IDENTIFIED BY '12345678';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

The

is actually related to the value of validate_password_policy.

validate_password_policy has the following values:

default is 1, which is MEDIUM, so the password you set at the beginning must be length, and must contain Numbers, lowercase or uppercase letters, and special characters.

sometimes, just for testing purposes, I don’t want to make the password that complicated. For example, I just want to set root’s password to 123456.

must modify two global parameters:

First, change the value of the validate_password_policy parameter

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

thus, the criteria for judging a password are based on the length of the password. This is determined by the validate_password_length parameter.

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|             8 |
+----------------------------+
1 row in set (0.00 sec)

The

validate_password_length parameter defaults to 8 and has a minimum value of

validate_password_number_count
+ validate_password_special_char_count
+ (2 * validate_password_mixed_case_count)

where validate_password_number_count specifies the length of the data in the password, validate_password_special_char_count specifies the length of the special characters in the password, and validate_password_mixed_case_count specifies the length of the size letters in the password.

these parameters have a default value of 1, so validate_password_length has a minimum value of 4. If you explicitly specify validate_password_length to be less than 4, it will not error, but validate_password_length will be 4. As follows:

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|             8 |
+----------------------------+
1 row in set (0.00 sec)
 
mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)
 
mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|             4 |
+----------------------------+
1 row in set (0.00 sec)

if you change validate_password_number_count, validate_password_special_char_count, and validate_password_mixed_case_count any value, then validate_password_length will be dynamically changed.

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|             4 |
+----------------------------+
1 row in set (0.00 sec)
 
mysql> select @@validate_password_mixed_case_count;
+--------------------------------------+
| @@validate_password_mixed_case_count |
+--------------------------------------+
|                  1 |
+--------------------------------------+
1 row in set (0.00 sec)
 
mysql> set global validate_password_mixed_case_count=2;
Query OK, 0 rows affected (0.00 sec)
 
mysql> select @@validate_password_mixed_case_count;
+--------------------------------------+
| @@validate_password_mixed_case_count |
+--------------------------------------+
|                  2 |
+--------------------------------------+
1 row in set (0.00 sec)
 
mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|             6 |
+----------------------------+
1 row in set (0.00 sec)

verify whether the validate_password plug-in is installed?You can view the following parameters, if not installed, the output will be empty.

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name            | Value |
+--------------------------------------+-------+
| validate_password_dictionary_file  |    |
| validate_password_length       | 6   |
| validate_password_mixed_case_count  | 2   |
| validate_password_number_count    | 1   |
| validate_password_policy       | LOW  |
| validate_password_special_char_count | 1   |
+--------------------------------------+-------+

Read More: