1、通过mysql -uroot -p,输入密码登录后,必须马上修改密码,否则会报错
2、将密码修改为123456,依然报错
这和mysql 5.7的密码策略(validate_password_policy)有关,validate_password_policy可以取如下值:
默认为1即MEDIUM,包含长度、数字、英文大小写、特殊字符校验。长度由validate_password_length配置,默认为8.
3、在/etc/my.cnf
配置文件中增加
4、修改密码为12345678,成功
5、查看当前密码策略
1 mysql> show VARIABLES like "%password%" 2 -> ; 3 +---------------------------------------+-------+ 4 | Variable_name | Value | 5 +---------------------------------------+-------+ 6 | default_password_lifetime | 0 | 7 | disconnect_on_expired_password | ON | 8 | log_builtin_as_identified_by_password | OFF | 9 | mysql_native_password_proxy_users | OFF | 10 | old_passwords | 0 | 11 | report_password | | 12 | sha256_password_proxy_users | OFF | 13 | validate_password_check_user_name | OFF | 14 | validate_password_dictionary_file | | 15 | validate_password_length | 8 | 16 | validate_password_mixed_case_count | 1 | 17 | validate_password_number_count | 1 | 18 | validate_password_policy | LOW | 19 | validate_password_special_char_count | 1 | 20 +---------------------------------------+-------+ 21 14 rows in set (0.01 sec)
default_password_lifetime:密码过期时间(天数),0表示永不过期
validate_password_length:密码长度,默认为8
validate_password_policy:密码复杂度
原文地址:https://www.cnblogs.com/zhangxianming/p/10262194.html
时间: 2024-10-31 11:34:00