Error (1820) if the password is not changed in time after MySQL installation

The password of MySQL was not changed in time when logging in for the first time

When downloading MySQL for the first time, because the password was not changed in time, it was prompted to change the password first.

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

When changing the password according to the requirements, the following error occurs when executing SQL command:

mysql> alter user 'root'@'localhost' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

The reason is that the password does not conform to the password rules, which is too simple.

Therefore, it is necessary to modify the password policy in time

set global validate_password_policy=0
set global validate_password_length=1;

validate_ password_ polic =
0 or low verify length only
1 or medium verify length, number, case and special characters
2 or strong verify length, number, case, special character and dictionary file

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

Read More: