How to install plugin into mysql? How to remove installed plugin from mysql?
**Directory for the plugin is $BASE/lib/plugin
1. Login into mysql and check for the plugin directory location.
mysql> select @@plugin_dir; +-----------------------------+ | @@plugin_dir | +-----------------------------+ | /u01/mysql/base/lib/plugin/ | +-----------------------------+ 1 row in set (0.00 sec) mysql>
2. We will try to install “Password” related plugin.
ls -lrth /u01/mysql/base/lib/plugin/validate*
-rwxr-xr-x 1 mysql mysql 149K Dec 17 2022 /u01/mysql/base/lib/plugin/validate_password.so
mysql> install plugin validate_password soname 'validate_password.so'; Query OK, 0 rows affected, 1 warning (0.05 sec) mysql> show plugins; | mysqlx | ACTIVE | DAEMON | NULL | GPL | | validate_password | ACTIVE | VALIDATE PASSWORD | validate_password.so | GPL | +----------------------------------+----------+--------------------+----------------------+---------+ 49 rows in set (0.01 sec) mysql> mysql> select * from information_schema.plugins where plugin_name like 'validate%' \G *************************** 1. row *************************** PLUGIN_NAME: validate_password PLUGIN_VERSION: 1.1 PLUGIN_STATUS: ACTIVE PLUGIN_TYPE: VALIDATE PASSWORD PLUGIN_TYPE_VERSION: 1.0 PLUGIN_LIBRARY: validate_password.so PLUGIN_LIBRARY_VERSION: 1.11 PLUGIN_AUTHOR: Oracle Corporation PLUGIN_DESCRIPTION: check password strength PLUGIN_LICENSE: GPL LOAD_OPTION: ON 1 row in set (0.00 sec) mysql> mysql> show global variables like 'validate%'; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | ON | | 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 | +--------------------------------------+--------+ 7 rows in set (0.04 sec) mysql>
3. Now try to create a new user with simple password.
mysql> create user test1@localhost identified by 'test1'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements mysql>
4. We can also set dictionary file to include the passwords which will not be accepted.
cat /u01/mysql/dist.txt abcd efgh test test2 mysql> set global validate_password_dictionary_file='/u01/mysql/dist.txt' ; Query OK, 0 rows affected (0.00 sec) mysql> mysql> show global variables like 'validate%'; +--------------------------------------+---------------------+ | Variable_name | Value | +--------------------------------------+---------------------+ | validate_password_check_user_name | ON | | validate_password_dictionary_file | /u01/mysql/dist.txt | | validate_password_length | 8 | | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | LOW | | validate_password_special_char_count | 1 | +--------------------------------------+---------------------+ 7 rows in set (0.00 sec) mysql>
5. Uninstall the plugin.
mysql> uninstall plugin validate_password; Query OK, 0 rows affected, 1 warning (0.35 sec) mysql>