mariadb上有很多功能插件,下面简要的说一下在命令行中的安装与卸载方法。本例以实现半同步功能的插件为例说明。
安装
MariaDB [(none)]> install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
Query OK, 0 rows affected (0.00 sec)
卸载
MariaDB [(none)]> uninstall plugin rpl_semi_sync_slave;
Query OK, 0 rows affected (0.00 sec)
帮助
MariaDB [(none)]> help plugin
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following
topics:
INSTALL PLUGIN
SHOW
UNINSTALL PLUGIN
MariaDB [(none)]> help install plugin;
Name: 'INSTALL PLUGIN'
Description:
Syntax:
INSTALL PLUGIN plugin_name SONAME 'shared_library_name'
This statement installs a server plugin. It requires the INSERT
privilege for the mysql.plugin table.
plugin_name is the name of the plugin as defined in the plugin
descriptor structure contained in the library file (see
http://dev.mysql.com/doc/refman/5.5/en/plugin-data-structures.html).
Plugin names are not case sensitive. For maximal compatibility, plugin
names should be limited to ASCII letters, digits, and underscore
because they are used in C source files, shell command lines, M4 and
Bourne shell scripts, and SQL environments.
shared_library_name is the name of the shared library that contains the
plugin code. The name includes the file name extension (for example,
libmyplugin.so, libmyplugin.dll, or libmyplugin.dylib).
The shared library must be located in the plugin directory (the
directory named by the plugin_dir system variable). The library must be
in the plugin directory itself, not in a subdirectory. By default,
plugin_dir is the plugin directory under the directory named by the
pkglibdir configuration variable, but it can be changed by setting the
value of plugin_dir at server startup. For example, set its value in a
my.cnf file:
[mysqld]
plugin_dir=/path/to/plugin/directory
If the value of plugin_dir is a relative path name, it is taken to be
relative to the MySQL base directory (the value of the basedir system
variable).
INSTALL PLUGIN loads and initializes the plugin code to make the plugin
available for use. A plugin is initialized by executing its
initialization function, which handles any setup that the plugin must
perform before it can be used. When the server shuts down, it executes
the deinitialization function for each plugin that is loaded so that
the plugin has a change to perform any final cleanup.
INSTALL PLUGIN also registers the plugin by adding a line that
indicates the plugin name and library file name to the mysql.plugin
table. At server startup, the server loads and initializes any plugin
that is listed in the mysql.plugin table. This means that a plugin is
installed with INSTALL PLUGIN only once, not every time the server
starts. Plugin loading at startup does not occur if the server is
started with the --skip-grant-tables option.
A plugin library can contain multiple plugins. For each of them to be
installed, use a separate INSTALL PLUGIN statement. Each statement
names a different plugin, but all of them specify the same library
name.
URL: http://dev.mysql.com/doc/refman/5.5/en/install-plugin.html
MariaDB [(none)]> help uninstall plugin;
Name: 'UNINSTALL PLUGIN'
Description:
Syntax:
UNINSTALL PLUGIN plugin_name
This statement removes an installed server plugin. It requires the
DELETE privilege for the mysql.plugin table.
plugin_name must be the name of some plugin that is listed in the
mysql.plugin table. The server executes the plugin's deinitialization
function and removes the row for the plugin from the mysql.plugin
table, so that subsequent server restarts will not load and initialize
the plugin. UNINSTALL PLUGIN does not remove the plugin's shared
library file.
URL: http://dev.mysql.com/doc/refman/5.5/en/uninstall-plugin.html