
A plugin can be installed with the mysql_plugin utility if the server is
completely offline.

The syntax is:

mysql_plugin [options] <plugin> ENABLE|DISABLE

For example, to install the server_audit audit plugin, you could execute the
following:

mysql_plugin server_audit ENABLE

If a plugin is installed with this utility, then a record will be added to the
mysql.plugins table for the plugin. This means that the plugin will
automatically be loaded every time the server restarts, unless specifically
uninstalled or deactivated.

Configuring the Plugin Directory
--------------------------------

When a plugin is being installed, the server looks for the plugin's library in
the server's plugin directory. This directory is configured by the plugin_dir
system variable. This can be specified as a command-line argument to mysqld or
it can be specified in a relevant server option group in an option file. For
example:

[mariadb]
...
plugin_dir = /usr/lib64/mysql/plugin

Configuring the Minimum Plugin Maturity
---------------------------------------

When a plugin is being installed, the server compares the plugin's maturity
level against the server's minimum allowed plugin maturity. This can help
prevent users from using unstable plugins on production servers. This minimum
plugin maturity is configured by the plugin_maturity system variable. This can
be specified as a command-line argument to mysqld or it can be specified in a
relevant server option group in an option file. For example:

[mariadb]
...
plugin_maturity = stable

Configuring Plugin Activation at Server Startup
-----------------------------------------------

A plugin will be loaded by default when the server starts if:

* The plugin was installed with the INSTALL SONAME statement.
* The plugin was installed with the INSTALL PLUGIN statement.
* The plugin was installed with the mysql_plugin utility.
* The server is configured to load the plugin with the --plugin-load-add
option.
* The server is configured to load the plugin with the --plugin-load option.

This behavior can be changed with special options that take the form
--plugin-name. For example, for the server_audit audit plugin, the special
option is called --server-audit.

The possible values for these special options are:

+---------------------------------------+------------------------------------+
| Option Value                          | Description                        |
+---------------------------------------+------------------------------------+
| OFF                                   | Disables the plugin without        |
|                                       | removing it from the               |
|                                       | mysql.plugins table.               |
+---------------------------------------+------------------------------------+
| ON                                    | Enables the plugin. If the plugin  |
|                                       | cannot be initialized, then the    |
|                                       | server will still continue         |
|                                       | starting up, but the plugin will   |
|                                       | be disabled.                       |
+---------------------------------------+------------------------------------+
| FORCE                                 | Enables the plugin. If the plugin  |
|                                       | cannot be initialized, then the    |
|                                       | server will fail to start with an  |
|                                       | error.                             |
+---------------------------------------+------------------------------------+
| FORCE_PLUS_PERMANENT                  | Enables the plugin. If the plugin  |
|                                       | cannot be initialized, then the    |
|                                       | server will fail to start with an  |
|                                       | error. In addition, the plugin     |
|                                       | cannot be uninstalled with         |
|                                       | UNINSTALL SONAME or UNINSTALL      |
|                                       | PLUGIN while the server is         |
|                                       | running.                           |
+---------------------------------------+------------------------------------+

A plugin's status can be found by looking at the PLUGIN_STATUS column of the
information_schema.PLUGINS table.

Uninstalling Plugins
--------------------

Plugins that are found in the mysql.plugin table, that is those that were
installed with INSTALL SONAME, INSTALL PLUGIN or mysql_plugin can be
uninstalled in one of two ways:

* The UNINSTALL SONAME or the UNINSTALL PLUGIN statement while the server is
running
* With mysql_plugin while the server is offline.

Plugins that were enabled as a --plugin-load option do not need to be
uninstalled. If --plugin-load is omitted the next time the server starts, or
the plugin is not listed as one of the --plugin-load entries, the plugin will
not be loaded.

UNINSTALL PLUGIN uninstalls a single installed plugin, while UNINSTALL SONAME
uninstalls all plugins belonging to a given library.

URL: https://mariadb.com/kb/en/plugin-overview/