How to create a six character password in MySQL 5.7

后端 未结 7 808
星月不相逢
星月不相逢 2021-01-31 11:05

I need to create a user with a six character password in new MySQL on my mac. I know that the lowest setting in 5.7 will allows only eight characters. Is there any way to go aro

7条回答
  •  遇见更好的自我
    2021-01-31 11:32

    First you login with mysql -u root -p and check the current policy rules by:

    # SHOW VARIABLES LIKE 'validate_password%';
    +--------------------------------------+--------+
    | Variable_name                        | Value  |
    +--------------------------------------+--------+
    | validate_password_dictionary_file    |        |
    | validate_password_length             | 5      |
    | validate_password_mixed_case_count   | 1      |
    | validate_password_number_count       | 1      |
    | validate_password_policy             | MEDIUM |
    | validate_password_special_char_count | 1      |
    +--------------------------------------+--------+
    

    Then you can change any of the above variables at your will:

    # SET GLOBAL validate_password_length = 5;
    # SET GLOBAL validate_password_number_count = 0;
    # SET GLOBAL validate_password_mixed_case_count = 0;
    # SET GLOBAL validate_password_special_char_count = 0;
    

    Finally you can create a database and a user accessing it with a simpler password:

    # CREATE DATABASE test1;
    # GRANT ALL PRIVILEGES ON test1.* TO user1@localhost IDENTIFIED BY "pass1";
    # FLUSH PRIVILEGES;
    

    After that you can login with mysql -u user1 -p test1 using password pass1

提交回复
热议问题