mysql_plugin - Configure MySQL Server Plugins

MySQLMySQLi Database

Let us understand mysql_plugin utlity used in MySQL −

The mysql_plugin utility allows MySQL administrators to manage the plugins that a MySQL server loads.

It provides an alternative to manually specify the --plugin-load option at server startup or with the help of INSTALL PLUGIN and UNINSTALL PLUGIN statements at runtime.

Depending on whether mysql_plugin is invoked to enable or disable plugins, the utility inserts or deletes rows respectively, in the mysql.plugin table which serves as a plugin registry.

For normal server startups, the server loads and enables the plugins which are listed in mysql.plugin automatically.

For additional control over the activation of the plugin, the --plugin_name options which is named for specific plugins can be used.

Each invocation of mysql_plugin will read a configuration file that helps determine how to configure the plugins that are contained in a single plugin library file. To invoke mysql_plugin, the below command can be used −

mysql_plugin [options] plugin {ENABLE|DISABLE}

Here, ‘plugin’ refers to the name of the plugin that is to be configured.

ENABLE or DISABLE is not case-sensitive and is used to specify whether to enable or disable the components of the plugin library which is named in the configuration file.

The order of the plugin and the ENABLE or DISABLE arguments doesn’t matter.

Let us take an example to understand this −

To configure components of a plugin library file which has the name ‘myplugins.so’ on Linux or ‘myplugins.dll’ on Windows, a plugin value of myplugins has to be specified.

Suppose this plugin library contains three plugins namely- plugin1, plugin2, and plugin3, all of which need to be configured under mysql_plugin control.

By convention, the configuration files have the suffix of .ini and the same base name as that of the plugin library, so the default configuration file name for this plugin library is ‘myplugins.ini’.

The configuration file contents would look like this −

myplugins
plugin1
plugin2
plugin3

The first line in the myplugins.ini file refers to the name of the library file, without any extension like .so or .dll.

The remaining lines are the names of the components that need to be enabled or disabled.

Each value in the file should be on a separate line.

Lines on which the first character is '#' is considered as a comment and ignored.

To enable the plugins that have been listed in the configuration file, the below mentioned mysql_plugin has to be invoked −

shell> mysql_plugin myplugins ENABLE

To disable the plugins, the DISABLE should be used instead of ENABLE.

An error occurs if mysql_plugin cannot find the configuration file or plugin library file, or if mysql_plugin cannot start the MySQL server.

The mysql_plugin supports the below mentioned options. They can be specified on the command line or in the [mysqld] group of any option file.

--help, -?

It helps display a help message and exit.

--basedir=dir_name, -b dir_name

It refers to the server base directory.

--datadir=dir_name, -d dir_name

It refers to the server data directory.

--my-print-defaults=file_name, -b file_name

It refers to the path where the my_print_defaults program exists.

--mysqld=file_name, -b file_name

it refers to the path to the mysqld server.

--no-defaults, -p

It indicates that no values should be read from the configuration file. This option enables an administrator to skip reading defaults from the configuration file.

--plugin-dir=dir_name, -p dir_name

It is the server plugin directory.

--verbose, -v

It refers to the verbose mode. It prints more information about what the program does. This option can be used multiple times to increase the amount of information.

--version, -V

It helps display version information and exit.

raja
Published on 10-Mar-2021 12:37:23
Advertisements