mysql5.7 Password Policy

Source: Internet
Author: User

To view an existing password policy

mysql> SHOW VARIABLES like ' validate_password% ';
+--------------------------------------+--------+
| variable_name | Value |
+--------------------------------------+--------+
| 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 |
+--------------------------------------+--------+
6 rows in Set (0.00 sec)

The Validate_password_number_count parameter is the number of digits at least in the password that takes effect when the password policy is medium or above.

The Validate_password_special_char_count parameter is the number of special characters such as non-English digits in the password, which takes effect when the password policy is medium or above.

The Validate_password_mixed_case_count parameter is the number of uppercase and lowercase characters in the password, which takes effect when the password policy is medium or above.

The Validate_password_length parameter is the length of the password, which is generated by the following formula

validate_password_number_count+ validate_password_special_char_count+ (2 * validate_password_mixed_case_count)

The Validate_password_dictionary_file parameter is the path to the dictionary file that specifies password validation.

Validate_password_policy This parameter can be set to 0, 1, 2, respectively, representing the password strength from low to high, the default value of this parameter is 1, if you want to change the strength of the password, this parameter is changed to 0.

Create User times Error:

mysql> CREATE USER ' test ' @ ' localhost ' identified by ' test ';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Cause of Error:
The password specified does not conform to the existing password policy.

Workaround:
You can set a password according to an existing policy, or you can change the password policy.

① specifying a password according to an existing password policy

mysql> CREATE USER ' test ' @ ' localhost ' identified by ' system#2016 ';
Query OK, 0 rows affected (0.16 sec)

② Change password Policy to reduce password validation criteria

--Change password policy to low
mysql> set global validate_password_policy=0;
Query OK, 0 rows Affected (0.00 sec)

--Change Password length
mysql> set global validate_password_length=0;
Query OK, 0 rows Affected (0.00 sec)

--Minimum password length is 4
mysql> SHOW VARIABLES like ' validate_password% ';
+--------------------------------------+-------+
| variable_name | Value |
+--------------------------------------+-------+
| Validate_password_dictionary_file | |
| Validate_password_length | 4 |
| Validate_password_mixed_case_count | 1 |
| Validate_password_number_count | 1 |
| Validate_password_policy | Low |
| Validate_password_special_char_count | 1 |
+--------------------------------------+-------+
6 rows in Set (0.00 sec)

mysql> drop user ' test ' @localhost;
Query OK, 0 rows affected (0.07 sec)

--Create a password with a length of 3 error
mysql> CREATE USER ' test ' @ ' localhost ' identified by ' TES ';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

--Create a password of length 4, 4 is the minimum length of an existing password policy
mysql> CREATE USER ' test ' @ ' localhost ' identified by ' test ';
Query OK, 0 rows affected (0.01 sec)

mysql5.7 Password Policy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.