Your password does not satisfy the current policy requirements

后端 未结 19 2517
眼角桃花
眼角桃花 2020-12-12 08:33

I want to create a new user in mysql with syntax:

create user \'demo\'@\'localhost\' identified by \'password\';

But it returns an error: <

相关标签:
19条回答
  • 2020-12-12 09:19

    I had the same Problem and the Answer is just Right in front of you, remember when you ran the script while installing mysql like

    sudo mysql_secure_installation

    there somewhere you chose which password type would you like to chose

    There are three levels of password validation policy:

    LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

    Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:

    you have to give a password to same policy

    here are some sample examples for your passwords:
    for type 0: abcdabcd
    for type 1: abcd1234
    for type 2: ancd@1234

    0 讨论(0)
  • 2020-12-12 09:19

    The problem is that your password wont match the password validation rules. You can simple follow below steps to solve your problem.

    You can simply see password validation configuration matrix by typing below code.

    mysql-> SHOW VARIABLES LIKE 'validate_password%';
    

    Then in your matrix you can find below variables with corresponding values and in there you have to check validate_password_length , validate_password_number_count and validate_password_policy.

    Check the values used for those variables. Make sure your validate_password_length should not be greater than 6. You can set that to 6 by using below code.

    SET GLOBAL validate_password_length = 6;
    

    And after that you need to set validate_password_number_count to 0. Do it by using below code.

    SET GLOBAL validate_password_number_count = 0;
    

    Finally you have to set you validate_password_policy to low. Having that as Medium or High wont allow your less secure passwords. Set that to low by below code.

    SET GLOBAL validate_password_policy=LOW;
    
    0 讨论(0)
  • 2020-12-12 09:21

    For MySQL 8*

    SET GLOBAL validate_password.policy=LOW

    Reference Link to explain about policy - Click Here

    0 讨论(0)
  • 2020-12-12 09:23
    mysql> SET GLOBAL validate_password.policy = 0;
    
    0 讨论(0)
  • 2020-12-12 09:24

    You have to change MySQL password policy to LOW.

    login as root

    mysql -u root -p
    

    change policy

    SET GLOBAL validate_password_policy=LOW;
    

    or

    SET GLOBAL validate_password_policy=0;
    

    exit

    exit
    

    restart MySQL service

    sudo service mysql restart
    

    You have to change the MySQL password policy to Low = 0 / Medium = 1 / High = 2.

    SET GLOBAL validate_password_policy=0;
    SET GLOBAL validate_password_policy=1;    
    SET GLOBAL validate_password_policy=2;
    
    0 讨论(0)
  • 2020-12-12 09:24

    If the mysql is hosted on aws , just uninstall the plugin. From the root user fire below

    UNINSTALL PLUGIN validate_password;
    
    0 讨论(0)
提交回复
热议问题