在数据库中创建用户时如果设置一个简单密码:
create user ch identified by '123456'
会报错:
ERROR1819(HY000): Your password doesnot satisfy thecurrentpolicy requirements
这个与 validate_password_policy 的值有关
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,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
设置 validate_password_policy=0
set global validate_password_policy=0
这是查看validate_password_length参数
select @@validate_password_length
@@validate_password_length | 最小长度 |
---|---|
8 | 4 |
默认密码的长度是8位,最小长度是4位,平常一般设置本地密码为123456。
set global validate_password_length=6
现在再创建新用户的时候就成功了。
用此命令查看相关此功能的参数:
show variables like 'validate%'
Variable_name | Value |
---|---|
validate_password_dictionary_file | |
validate_password_mixed_case_count | 1 |
validate_password_number_count | 1 |
validate_password_special_char_count | 1 |
validate_password_length | 6 |
validate_password_policy | LOW |
其中,validate_password_dictionary_file参数是指定密码验证的字典文件路径,validate_password_mixed_case_count参数是密码中英文字符大小写的个数,当密码策略是MEDIUM或以上时生效,
validate_password_number_count指定了密码中数据的长度,这个参数由下面的公式生成:
validate_password_number_count+ validate_password_special_char_count+ (2 * validate_password_mixed_case_count),
validate_password_special_char_count参数是密码中非英文数字等特殊字符的个数,当密码策略是MEDIUM或以上时生效。
网友评论