One, query plug-in
1. Log in to mysql and query the installed plugins: show plugins;
2. Query the location of the mysql plugin directory: show variables like "%plugin_dir%";
You can see that mysql comes with the validate_password plugin but it is not installed
2. Install the plug-in:
The first way (recommended):
Command execution: install plugin validate_password soname'validate_password.so';
Register the plug-in at runtime. No need to restart mysql
The second way:
The my.cnf configuration file is added, and then mysql needs to be restarted
[mysqld]
plugin-load=validate_password=validate_password.so
Three, configure the plug-in
The first way (recommended)
Just modify the global variables directly, for example: set global validate_password_policy=2
The second way:
Restart mysql after the my.cnf configuration file
[mysqld]
plugin-load=validate_password.so
validate_password_policy=2
validate-password=FORCE_PLUS_PERMANENT
4. Query configuration
Log in to mysql again and execute show variables like'validate_password%';
Each configuration description in the above figure:
validate-password=ON/OFF/FORCE/FORCE_PLUS_PERMANENT: 决定是否使用该插件(及强制/永久强制使用)。
validate_password_dictionary_file:插件用于验证密码强度的字典文件路径。
validate_password_length:密码最小长度。
validate_password_mixed_case_count:密码至少要包含的小写字母个数和大写字母个数。
validate_password_number_count:密码至少要包含的数字个数。
validate_password_policy:密码强度检查等级,0/LOW、1/MEDIUM、2/STRONG。
validate_password_special_char_count:密码至少要包含的特殊字符数。
其中,关于validate_password_policy-密码强度检查等级:
0/LOW:只检查长度。
1/MEDIUM:检查长度、数字、大小写、特殊字符。
2/STRONG:检查长度、数字、大小写、特殊字符字典文件。
You can modify the variables directly, for example: set global validate_password_policy=2
5. Change the password to test the plug-in
SET PASSWORD FOR root@'%' = password('123456');
6. Expansion
Uninstall plugin command: uninstall plugin rpl_semi_sync_slave;
if you want to close the built-in plugin, such as MRG_MYISAM plugin, the configuration is as follows:
[mysqld]
MRG_MYISAM=OFF