# 密码策略

# 查看密码策略

#查看密码策略
show variables like '%validate_password.policy%';
show variables like '%validate_password.length%';
#修改密码策略
set global validate_password.policy=0;  #设置为弱口令
set global validate_password.length=1;  #密码最小长度为1

查看密码策略的所有参数:

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| 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(校验规则),取值范围[0,1,2],默认值1。0(LOW):只校验长度;1(MEDIUM):校验长度、大小写和特殊字符;2(STRONG):校验长度、大小写、特殊字符和dictionary_file.

关于评论

评论前请填好“昵称”、“邮箱”这两栏内容,否则不会收到回复,谢谢!