Mysql appears the error 1819 (HY000) solution _mysql

Source: Internet
Author: User

Error 1819 (HY000): Your password does not satisfy the current policy requirements, what happens to this problem? Don't worry, here's the answer.

In order to enhance security, MySQL5.7 generated a random password for the root user, in the error log, the location of the error log, if the installation of the RPM package, the default is/var/log/mysqld.log.

General can be set by Log_error

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

Can get the temporary password for MySQL through the # grep ' password '/var/log/mysqld.log command

Copy Code code as follows:
2016-01-19t05:16:36.218234z 1 [note] A temporary password are generated for ROOT@LOCALHOST:WAQ,QR%BE2 (5

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

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

If only modified 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.

Validate_password_policy has the following values:

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, and special characters.

Sometimes, just for your own testing, do not want to set the password so complex, 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 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, which has a minimum value of a limit 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 character in the password, Validate_ PASSWORD_MIXED_CASE_COUNT Specifies the length of the letter in the password.

These parameters, the default value is 1, so the validate_password_length minimum is 4, if you explicitly specify Validate_password_length value is less than 4, although 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 of the values in count, the validate_password_length will be 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, the prerequisite is that 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 they are 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)

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.