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

Source: Internet
Author: User

Transferred from: http://www.linuxidc.com/Linux/2016-01/127831.htm

To enhance security, MySQL5.7 randomly generates a password for the root user, in error log, about the location of the error log and, if the RPM package is installed, the default is/var/log/mysqld.log.

Generally available through Log_error settings

Mysql> SELECT @ @log_error; +---------------------+| @ @log_error         |+---------------------+|/var/log/mysqld.log |+---------------------+1 row in Set (0.00 sec)

MySQL's temporary password can be obtained via the # grep "password"/var/log/mysqld.log command

2016-01-19t05:16:36.218234z 1 [Note] A temporary password is generated for [email protected]: waq,qr%be2 (5

After you log on to the server with this password, you must change the password immediately, or you will receive the following error:

Mysql> Select User (); ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.

If you just change to a simple password, the following error will be reported:

mysql>  ALTER User User () identified by ' 12345678 '; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

This is actually related to the value of Validate_password_policy.

The validate_password_policy has the following values:

Policy Tests performed
0OrLOW Length
1OrMEDIUM Length; Numeric, lowercase/uppercase, and special characters
2OrSTRONG Length; Numeric, lowercase/uppercase, and special characters; Dictionary file

The default is 1, which is medium, so the password you just started must match the length and must contain numbers, lowercase or uppercase letters, special characters.

Sometimes, just for your own testing, don't want to set the password so complicated, for example, I just want to set the root password is 123456.

Two global parameters must be modified:

First, modify the value of the Validate_password_policy parameter

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

In this way, the criteria for judging the password is 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 it has the minimum limit, and the minimum value is:

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, Validate_ PASSWORD_MIXED_CASE_COUNT Specifies the length of the size letter in the password.

These parameters, the default value is 1, so the Validate_password_length minimum value is 4, if you explicitly specify that the value of validate_password_length is less than 4, although there is no error, but Validate_password_ The value of length will be set to 4. As shown below:

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 modify the Validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_ Any value in count, Validate_password_length is dynamically modified.

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) 

Of course, if the Validate_password plugin must already be installed, MySQL5.7 is installed by default.

So how do you verify that the Validate_password plugin is installed? You can view the following parameters, and 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     |+--------------------------------------+-------+6 rows In Set (0.00 sec)

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.