8.0版本:
查看密码策略
show variables like '%validate_password.policy%';
show variables like '%validate_password.length%';
修改密码策略,设置为弱口令,密码最小长度为1
set global validate_password.policy=0;
set global validate_password.length=1;
更改密码方式:
alter user 'root'@'localhost' identified by 'newpassword';
5.7版本:
查看密码策略
show variables like '%validate_password_policy%';
show variables like '%validate_password_length%';
修改密码策略
set global validate_password_policy=0;
set global validate_password_length=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
5.6版本
更改密码方式:
update mysql.user set password=password('password') where user='root';
网友评论