Mysql 5.7ERROR 1820 (HY000): You must reset your password using ALTER USER statement before execut(代

Posted 柳絮拂面

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql 5.7ERROR 1820 (HY000): You must reset your password using ALTER USER statement before execut(代相关的知识,希望对你有一定的参考价值。

1、通过mysql -uroot -p,输入密码登录后,必须马上修改密码,否则会报错

2、将密码修改为123456,依然报错

 

这和mysql 5.7的密码策略(validate_password_policy)有关,validate_password_policy可以取如下值:

默认为1即MEDIUM,包含长度、数字、英文大小写、特殊字符校验。长度由validate_password_length配置,默认为8.

3、在/etc/my.cnf配置文件中增加

4、修改密码为12345678,成功

 

 5、查看当前密码策略

 1 mysql> show VARIABLES like "%password%"
 2     -> ;
 3 +---------------------------------------+-------+
 4 | Variable_name                         | Value |
 5 +---------------------------------------+-------+
 6 | default_password_lifetime             | 0     |
 7 | disconnect_on_expired_password        | ON    |
 8 | log_builtin_as_identified_by_password | OFF   |
 9 | mysql_native_password_proxy_users     | OFF   |
10 | old_passwords                         | 0     |
11 | report_password                       |       |
12 | sha256_password_proxy_users           | OFF   |
13 | validate_password_check_user_name     | OFF   |
14 | validate_password_dictionary_file     |       |
15 | validate_password_length              | 8     |
16 | validate_password_mixed_case_count    | 1     |
17 | validate_password_number_count        | 1     |
18 | validate_password_policy              | LOW   |
19 | validate_password_special_char_count  | 1     |
20 +---------------------------------------+-------+
21 14 rows in set (0.01 sec)
default_password_lifetime:密码过期时间(天数),0表示永不过期
validate_password_length:密码长度,默认为8
validate_password_policy:密码复杂度

以上是关于Mysql 5.7ERROR 1820 (HY000): You must reset your password using ALTER USER statement before execut(代的主要内容,如果未能解决你的问题,请参考以下文章

mysql-5.7 密码过期详解

mysql 5.7报错

MySQL ERROR 1820 (HY000)

mysql 报错ERROR 1820 (HY000):You must resetpassword

Mysql 5.7初始化密码

mysql密码更改不了解决方法