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

MySQL报错“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)
  • 设置密码验证强度等级,将MEDIUM设置为LOW。
mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)
  • 修改密码默认长度为6
mysql> set global validate_password_length=6;
Query OK, 0 rows affected (0.01 sec)

现在只要满足六位的长度的简单密码即可设置

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
  • 关于 mysql 密码策略相关参数;
  • validate_password_length  固定密码的总长度;
  • validate_password_dictionary_file 指定密码验证的文件路径;
  • validate_password_mixed_case_count  整个密码中至少要包含大/小写字母的总个数;
  • validate_password_number_count  整个密码中至少要包含阿拉伯数字的个数;
  • validate_password_policy 指定密码的强度验证等级,默认为 MEDIUM;
  • 关于 validate_password_policy 的取值:
0/LOW:只验证长度;
1/MEDIUM:验证长度、数字、大小写、特殊字符;
2/STRONG:验证长度、数字、大小写、特殊字符、字典文件;
  • validate_password_special_char_count 整个密码中至少要包含特殊字符的个数。

发表评论