mysql5.7 password initialization error ERROR 1820 (HY000)

After installation on a cloud server mysql5.7, login error after error: 1820

1820 mistake 

You must reset your password using ALTER USER statement before executing this statement.

Explanation: Before executing this statement, you must use the ALTER USER statement to reset your password.

 

 Has tried a lot of ways, ultimately found to be related to the value of validate_password_policy

validate_password_policy have the following values:

Policy      Tests Performed

0 or LOW     Length

1 or MEDIUM    Length; numeric,lowercase/uppercase,and special characters

2 or STRONG 1 on the basis of more than a dictionary file dictionary file

The default is 1, that is, MEDIUM, so just start setting password must meet the length and must contain numbers, uppercase or lowercase letters, special characters

  Two global parameters must be modified

   1, the value of the parameter modification validate_password_policy

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

  2, validate_password_length (password length) parameter defaults to 8, we changed to 1

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

 

   3, after the changes are complete statement is executed again to change the password to success

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

 

 Log in again, enter the newly created password to complete the use of MySQL5.7

 

In view of this problem, a brief explanation:

For added security, MySQL5.7 randomly generate a password for the root user, the error log in

By cat /var/log/mysqld.log | grep password to view this temporary password

 

Use this password to log into the server, you must immediately change your password, or the database is not working

 Step subsequent essays above can be solved in order to

 

Guess you like

Origin www.cnblogs.com/security-guard/p/12470760.html