How do I turn off the mysql password validation?

后端 未结 13 1257
傲寒
傲寒 2021-01-29 17:34

It seems that I may have inadvertently loaded the password validation plugin in MySQL 5.7. This plugin seems to force all passwords to comply to certain rules.

I would l

13条回答
  •  伪装坚强ぢ
    2021-01-29 18:15

    Building on the answer from Sharfi, edit the /etc/my.cnf file and add just this one line:

    validate_password_policy=LOW
    

    That should sufficiently neuter the validation as requested by the OP. You will probably want to restart mysqld after this change. Depending on your OS, it would look something like:

    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.

    For more info about the levels and details, see the mysql doc.


    For MySQL 8, the property has changed from "validate_password_policy" to "validate_password.policy". See the updated mysql doc for the latest info.

提交回复
热议问题