How do I turn off the mysql password validation?

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

    For mysql 8.0.7, Go to your mysql directory, and then use:

    sudo bin/mysql_secure_installation
    

    to configure the password option.

    0 讨论(0)
  • 2021-01-29 18:06
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'organizer'@'localhost'  WITH GRANT OPTION;
    
    CREATE USER 'username'@'%' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'organizer'@'%' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    

    no need to stop/start mysql

    0 讨论(0)
  • 2021-01-29 18:07

    To disable password checks in mariadb-10.1.24 (Fedora 24) I had to comment out a line in /etc/my.cnf.d/cracklib_password_check.cnf file:

    ;plugin-load-add=cracklib_password_check.so
    

    then restart mariadb service:

    systemctl restart mariadb.service
    
    0 讨论(0)
  • 2021-01-29 18:07

    You can configure this in mysql configuration file open /etc/my.cnf file In this file all the lines which is configuring the password policy make those commented like

    #validate-password=FORCE_PLUS_PERMANENT
    #validate_password_length=10
    #validate_password_mixed_case_count=1
    #validate_password_number_count=1
    #validate_password_policy=MEDIUM
    

    Uncomment and change the value of the properties you want to change.

    0 讨论(0)
  • 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 !

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题