mysql初始设置密码报错处理方法ERROR 1819 (HY000): Your password does not satisfy the current policy requirement

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql初始设置密码报错处理方法ERROR 1819 (HY000): Your password does not satisfy the current policy requirement相关的知识,希望对你有一定的参考价值。

设置密码:

mysql> set password for root@localhost = password(‘test123‘);                                                                                                  

报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

直译报错:您的密码不符合当前的政策要求(密码初始验证策略要求)

查看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      |                                                                                                               
+--------------------------------------+--------+                                                                                                               
7 rows in set (0.00 sec)  
变量定义:
1、validate_password_check_user_name:验证密码检查用户名,非必须
2、validate_password_dictionary_file:验证密码字典文件,无要求
3、 validate_password_length:验证密码长度,8字符
4、validate_password_mixed_case_count:验证密码混合大小写,否
5、validate_password_policy:验证密码策略,中等
6、validate_password_special_char_count:验证密码特殊字符数,否
 
报错其实与validate_password_policy的值有关,validate_password_policy有以下取值:
Policy Tests Performe(要求)
0 or LOW Length
1 or MEDIUM numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
解决办法:
简单2步即可解决,修改验证密码相关数据以支持简单密码设置:
mysql> set global validate_password_length=6;                                                                                                                   
Query OK, 0 rows affected (0.00 sec)                                                                                                                            
                                                                                                                                                                
mysql> set global validate_password_policy=0;                                                                                                                   
Query OK, 0 rows affected (0.00 sec)                                                                                                                            
                                                                                                                                                           
mysql> set password for root@localhost = password(‘test123‘);                                                                                                   
Query OK, 0 rows affected, 1 warning (0.01 sec)
设置密码成功。

以上是关于mysql初始设置密码报错处理方法ERROR 1819 (HY000): Your password does not satisfy the current policy requirement的主要内容,如果未能解决你的问题,请参考以下文章

mysql5.7初始化密码报错 ERROR 1820 (HY000)

修改MySQL密码报错“ERROR 1819 (HY000): Your password does not satisfy the current policy requirements“(代码片段

Mysql5.7.18.1修改用户密码报错ERROR 1054 (42S22):

mysql5.7初始化密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement

Ubuntu18.04安装MySQL(未设置密码或忘记密码)

初次安装mysql时,没有设置初始密码的解决方法