How do I turn off the mysql password validation?

后端 未结 13 1517
傲寒
傲寒 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:07

    For references and the future, one should read the doc here https://dev.mysql.com/doc/mysql-secure-deployment-guide/5.7/en/secure-deployment-password-validation.html

    Then you should edit your mysqld.cnf file, for instance :

    vim /etc/mysql/mysql.conf.d/mysqld.cnf
    

    Then, add in the [mysqld] part, the following :

    plugin-load-add=validate_password.so
    validate_password_policy=LOW
    

    Basically, if you edit your default, it will looks like :

    [mysqld]
    #
    # * Basic Settings
    #
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    lc-messages-dir = /usr/share/mysql
    skip-external-locking
    plugin-load-add=validate_password.so
    validate_password_policy=LOW
    

    Then, you can restart:

    systemctl restart mysql
    

    If you forget the plugin-load-add=validate_password.so part, you will it an error at restart.

    Enjoy !

提交回复
热议问题