Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Databases»MySQL»How to Change MySQL Password Policy Level

    How to Change MySQL Password Policy Level

    By RahulJanuary 11, 20222 Mins Read

    The latest MySQL servers come with a validate password plugin. This plugin configures a password policy to make MySQL server more secure.

    Advertisement

    While changing the password, I got the error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    Follow below tutorial to change password policy level for MySQL. Alternatively, you can also use this tutorial to remove the password policy plugin.

    Change MySQL Password Policy

    To change the default password policy level, we can change the settings at runtime using the command line or in the config file (my.cnf/mysqld.cnf) permanently.

    Login to MySQL command prompt and execute the below query to view current settings of validate_password.

    1
    mysql> SHOW VARIABLES LIKE 'validate_password%';

    Output
    +--------------------------------------+--------+ | 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 | +--------------------------------------+--------+ 7 rows in set (0.01 sec)

    The default level is MEDIUM, we can change it to LOW by using the below query. The LOW level required only password’s length to min 8 characters.

    1
    mysql> SET GLOBAL validate_password.policy=LOW;

    Output
    Query OK, 0 rows affected (0.02 sec)

    To make this setting permanent edit MySQL configuration (my.cnf) file and add below settings.

    [mysqld]
    validate_password.policy=LOW
    

    Save the file and restart the MySQL service to apply changes.

    MySQL password Policy
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Securing MySQL Database with Limited User Permissions

    How to Install LAMP Stack on RHEL & CentOS Stream 9

    (Resolved) MySQL connection error: certificate verify failed

    View 13 Comments

    13 Comments

    1. Andrew on February 10, 2022 8:52 pm

      i noticed some changes
      SET GLOBAL validate_password_policy=LOW; //instead of validate_password.policy for mysql 5.7*

      Reply
    2. Frank Balbier on January 7, 2022 4:17 pm

      Please correct :
      validate_password_policy -> wrong
      validate_password.policy -> right

      Reply
      • Rahul on January 11, 2022 2:10 am

        Thanks Frank, Required update done

        Reply
    3. Johnny on May 15, 2021 9:10 pm

      Adding

      [mysqld]
      validate_password_policy=2

      (or 0 for LOW) to my /etc/mysql/my.cnf file, or to my /etc/mysql/mysql.conf.d/mysql.cnf file alone did not work for me. When restarting mysql, I kept getting “Job for mysql.service failed because the control process exited with error code.” error. Then I added the plugin line (below) and restarted mysql, and it worked – my password policy changed on mysql startup. I got the idea from this bug report: https://bugs.mysql.com/bug.php?id=93959 and it worked for me. Hopefully this will help someone, before you pull out all your hair:

      Add to /etc/mysql/my.cnf
      [mysqld]
      plugin-load-add=validate_password.so
      validate_password_policy=2

      Then, on the Linux command line, type and execute:
      sudo service mysql restart

      and (hopefully) mysql will start without error. Verify your password policy by running this command in the mysql command line (with root access):
      SHOW VARIABLES LIKE ‘validate_password%’;

      and hopefully you will see validate_password_policy STRONG (or LOW, or whatever you have set in my.cnf) in the result set.

      Reply
    4. anon on January 3, 2021 9:05 am

      The variable names changes between mysql5.6 and mysql8.0, see

      https://dev.mysql.com/doc/refman/8.0/en/validate-password-transitioning.html

      Reply
    5. Gabriel Vila Real on May 25, 2020 7:42 pm

      Thank you for this useful tip!
      I used to have the root user with a blank password on my development environment. I need to set the full set of validation variables password on mysqld.cnf to it works again. On mysqld.cnf now I have:

      validate_password.check_user_name=OFF
      validate_password.dictionary_file=
      validate_password.length=0
      validate_password.mixed_case_count=0
      validate_password.number_count=0
      validate_password.policy=LOW
      validate_password.special_char_count=0

      Reply
    6. Frank on December 20, 2019 11:30 pm

      Hi there,
      thanks for direction, there is a typo, you have:
      mysql> SET GLOBAL validate_password_policy=LOW;
      it should be:
      mysql> SET GLOBAL validate_password.policy=LOW;
      (as visible from command:)
      SHOW VARIABLES LIKE ‘validate_password%’;

      All the best,

      Reply
      • David on May 25, 2020 10:18 pm

        Thank you Frank. You saved my time and effort on this issue

        Reply
      • Maxwell Rayce on February 22, 2021 2:49 pm

        Life saver. Thanks man

        Reply
    7. TY on December 15, 2019 5:11 pm

      The permanent edit:
      [mysqld]
      validate_password_policy=LOW
      crashed my MySQL server.
      I am on 5.7.28, Ubuntu 18.04

      Reply
      • Henrique on December 20, 2019 7:28 pm

        Try this instead:
        [mysqld]
        validate_password.policy=LOW

        Reply
        • hicall on December 30, 2019 10:29 am

          thanks brow, work it on mysql v8

          Reply
    8. Jonathan on April 16, 2019 3:03 am

      Thankyou, very useful since I accidentally set my policy to STRONG by mistake.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.