MySQL8.0用户密码注意事项

密码的控制机制收到validate_password限制,可以通过

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 |

+--------------------------------------+--------+

其中validate_password.length控制着密码的长度,validate_password.policy中止着密码的策略,low为长度约束,medium为长度约束加上大小写字母、数字、特殊字符的要求,strong比medium多了一个文件校验,参见https://dev.mysql.com/doc/refman/8.0/en/validate-password-options-variables.html。若是设置密码的时候出现ERROR 1305(HY000):Your password does not satisfy the current policy requirement,而你还就想用这个密码,可以通过调节validate_password各个变量来降低数据库密码需求来使得密码可用。

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

除了上述变量之外,MySQL8.0默认的认证插件为Caching_sha2_password,原来是mysql_native_password,这使得原来的Navicat等连接出现认证失败,可以通过修改配置文件等方法进行设置。

猜你喜欢

转载自blog.csdn.net/ddsszzy/article/details/80276742