似乎我无意中在MySQL 5.7中加载了密码验证插件。这个插件似乎强制所有密码遵守某些规则。
我想把这个关了。
我已经尝试按照这里的建议更改validate_password_length变量,但没有用。
mysql> SET GLOBAL validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'app' = PASSWORD('abcd');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
我想要么卸载插件或中性它以某种方式。
根据Sharfi的回答,编辑/etc/my.cnf文件并添加这一行:
validate_password_policy=LOW
这应该足以中和op所要求的验证。在这个更改之后,您可能需要重新启动mysqld。根据你的操作系统,它看起来像这样:
sudo service mysqld restart
validate_password_policy takes either values 0, 1, or 2 or words LOW, MEDIUM, and STRONG which correspond to those numbers. The default is MEDIUM (1) which requires passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters. Changing to LOW as I suggest here then only will check for length, which if it hasn't been changed through other parameters will check for a length of 8. If you wanted to shorten that length limit too, you could also add validate_password_length in to the my.cnf file.
有关级别和细节的更多信息,请参阅mysql文档。
对于MySQL 8,属性已经从“validate_password_policy”更改为“validate_password.policy”。请参阅更新后的mysql文档获取最新信息。