2025年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 requirementsERROR 1819 HY000 Your password does not satisfy the current policy requirements MySQL5 7 为 root 用户随机生成了一个密码 在 error log 中 关于 error log 的位置 默认是 var log mysqld log 获取随机密码

大家好,我是讯享网,很高兴认识大家。

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

MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,默认是/var/log/mysqld.log
获取随机密码:
grep “password” /var/log/mysqld.log
在这里插入图片描述
讯享网

[root@instance-2lfpjykx ~]# mysql -uroot -p 输入随机密码登入mysql 

讯享网
讯享网修改用户密码 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxx'; 

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

这个与validate_password_policy的值有关,修改为一个简单的密码,会报以上错误。

Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters;dictionary file

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
不想密码设置得那么复杂,如只想设置root的密码为
设置
set global validate_password_policy=0;
现在密码只需符合长度限制

在这里插入图片描述

validate_password_length参数默认为8,它有最小值的限制,最小值为: Length = validate_password_number_count+validate_password_special_char_count+ (2 * validate_password_mixed_case_count) 其中,validate_password_number_count指定了密码中数据的长度,validate_password_special_char_count指定了密码中特殊字符的长度,validate_password_mixed_case_count指定了密码中大小字母的长度。 这些参数,默认值均为1,所以validate_password_length最小值为4,如果你显性指定validate_password_length的值小于4,尽管不会报错,但validate_password_length的值将设为4。 
讯享网mysql> set global validate_password_length = 6; Query OK, 0 rows affected (0.00 sec) mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 6 | +----------------------------+ 
小讯
上一篇 2025-03-26 16:06
下一篇 2025-04-04 15:59

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/69545.html