This is when mysql is initialized, a temporary password is used, and when the custom password is modified, because the custom password is relatively simple, there is a problem that does not comply with the password policy.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Solution:
① View the initial password policy of mysql:
mysql> SHOW VARIABLES LIKE 'validate_password%';
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
② First, you need to set the verification strength level of the password, and set the global parameter of validate_password_policy to LOW:
mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)
③ The current password length is 8 and can be set to a 4-digit password:
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
④ Now you can set a simple password for mysql:
mysql> update user set authentication_string=password('123456') where user='root';
Query OK, 2 rows affected, 1 warning (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 1
mysql> quit
Bye
⑤ Restart the mysql service:
[root@nginx-dev apps]# service mysqld restart