Mysql 5.7 Default password strength requirements for user passwords, if you specify a weak password, you will be prompted as follows:
1819 not Current policy requirements
The password strength control in Mysql 5.7 is implemented by the plugin, which is controlled by the file/usr/lib64/mysql/plugin/validate_password.so on the operating system (RPM installation, which is the default location). First to understand the password policy
- View the default password policy
Mysql>Show variables like 'validate_password_%';+--------------------------------------+--------+|Variable_name|Value|+--------------------------------------+--------+|Validate_password_check_user_name| OFF ||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 |+--------------------------------------+--------+
Where we see the parameter: the value of Validate_password_policy (that is, the password policy) is medium. The official values for this parameter are described below:
Policy |
Explanation |
0 or Low |
Length |
1 or MEDIUM |
0+numeric;lowercase/uppercase; Special characters |
2 or strong |
1+validate_password_dictionary_file |
In the above show variables see the parameters, in addition to Validate_password_policy, the other is the password policy of various control parameters.
-
-
- Validate_password_length---> Password length, default 8
- Validate_password_mixed_case_count---> Uppercase and lowercase letters each of the minimum number of, default on, at least 1.
- Validate_password_number_count---> contains number of numbers, default >= 1
- Validate_password_special_char_count---> Number of special characters, default >= 1
- Validate_password_dictionary_file---> Password strength control dictionary path.
2. Password strength verification on and off 2.1 enabled
The library object file corresponding to the plugin needs to be in the directory specified in configuration options plugin_dir.
You can use--plugin-load=validate_password.so to load the plug-in at server startup, or write plugin-load=validate_password.so to the configuration file:
[mysqld] plugin - Load = validate_password.sovalidate -Password=force_plus_permanent
You can also load a plug-in from the server runtime by using the following statement (it will register into the Mysql.plugins table)
MySQL>'validate_password.so';
2.2 Close Method 1) Close password policy
In the /etc/my.cnf
configuration file, add:
[mysqld] Validate_password = off
Then restart MySQL
Method 2) Change the password policy
set global validate_password_policy=0; # Change Password policy tolowset global validate_password_length=0; # password length is set to 0, that is, a password greater than 0 characters can be
Method 3) Do not enable plugins when initializing MySQL
Mysqld--initialize-insecure--datadir=/var/lib/mysql--basedir=/usr--user=mysql
Mysql 5.7 Password Policy ERROR 1819 (HY000)