Set password for ' root ' @ ' localhost ' =password (' mynewpass4! ');
mysql5.7 The password security check plug-in (Validate_password) is installed by default, and the default password-checking policy requires that the password must contain: uppercase and lowercase letters, numbers, and special symbols, and not less than 8 bits in length. Otherwise you will be prompted for error 1819 (HY000): Your password does not satisfy the current policy requirements error as shown:
You can view information about the password policy through the MSYQL environment variable:
like ‘%password%‘;
Validate_password_policy: Password policy, default to Medium policy
Validate_password_dictionary_file: Password policy file, policy for strong only required
Validate_password_length: Minimum Password length
Validate_password_mixed_case_count: Uppercase and lowercase character length, at least 1
Validate_password_number_count: Number of at least 1
Validate_password_special_char_count: Minimum of 1 special characters
The above parameter is the password check rule for the default policy medium.
There are several password policies:
Strategy |
Check Rules |
0 or Low |
Length |
1 or MEDIUM |
Length; Numeric, lowercase/uppercase, and special characters |
2 or strong |
Length; Numeric, lowercase/uppercase, and special characters; Dictionary file |
MySQL official website Password Policy detailed description: Http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_ Validate_password_policy
Modify Password Policy
Add validate_password_policy configuration in/etc/my.cnf file, specify password policy
# 选择0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件validate_password_policy=0
If you do not require a password policy, add the following configuration to disable the My.cnf file:
validate_password = off
Restarting the MySQL service causes the configuration to take effect:
systemctl restart mysqld
MySQL Change password