当前位置: 代码迷 >> 综合 >> Mysql报错 Your password does not satisfy the current policy requirements ErrorCode: 1819
  详细解决方案

Mysql报错 Your password does not satisfy the current policy requirements ErrorCode: 1819

热度:32   发布时间:2023-11-28 02:09:09.0

报错信息

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.01 sec)
//首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可
mysql> set global validate_password_policy=LOW; 
Query OK, 0 rows affected (0.00 sec)
//再设置validate_password_length 的全局参数为 1 即可
mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 4     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
  相关解决方案