解决 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

这是 mysql 初始化时,使用临时密码,修改自定义密码时,由于自定义密码比较简单,就出现了不符合密码策略的问题。

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
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      |
+--------------------------------------+--------+

② 首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW :

mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)

③ 当前密码长度为 8 ,可以设置为4位的密码:

mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)

④ 现在可以为 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

⑤ 重启 mysql 服务:

[root@nginx-dev apps]# service mysqld restart

猜你喜欢

转载自blog.csdn.net/qq_42764468/article/details/132512406
今日推荐