安装插件mysql
内置插件时服务器可以自动识别的,一般在服务器启动时加载内置插件。sql
在mysql.plugin表中注册的插件,这种插件不一样于内置插件(内置插件不须要注册),一般在服务器启动时会加载mysql.plugin表中的插件,同时会启用这些插件。服务器
使用命令行选项指定的插件:ui
--plugin-load 选项:以分号分隔插件,最后一个--plugin-load生效this
--plugin-load-add:对plugin-load 选项的补充spa
注:这两个选项都是在内置插件、存储引擎加载后加载插件
--early-plugin-load:命令行
这个选项是在内置插件、存储引擎加载前加载server
这三个选项指定的插件都不会注册到mysql.plugin表中,全部若是在服务器重启后也可以使用,能够将其写到选项文件中。ci
好比:
[mysqld]
plugin-load=myplugin=somepluglib.so
在服务器运行时,经过INSTALL PLUGIN语句安装插件,经过这种方式安装的插件会注册到mysql.plugin表中。好比:
INSTALL PLUGIN myplugin SONAME 'somepluglib.so';
注:若是插件不能再运行时经过INSTALL PLUGIN语句安装,能够经过--load-plugin方式加载插件到服务器中。
在服务器启动时控制插件ACTIVATION状态:
--plugin_name=OFF
Tells the server to disable the plugin.
This may not be possible for certain built-in plugins, such as mysql_native_password.
--plugin_name[=ON]
Tells the server to enable the plugin. (Specifying the option as --plugin_name without a value has the same effect.) If the plugin fails to initialize, the server runs with the plugin disabled.
--plugin_name=FORCE
Tells the server to enable the plugin, but if plugin initialization fails, the server does not start. In other words, this option forces the server to run with the plugin enabled or not at all.
--plugin_name=FORCE_PLUS_PERMANENT
Like FORCE, but in addition prevents the plugin from being unloaded at runtime. If a user attempts to do so with UNINSTALL PLUGIN, an error occurs.
能够经过INFORMATION_SCHEMA.PLUGINS表的LOAD_OPTION列查看插件ACTIVATION状态。
卸载插件
UNINSTALL PLUGIN语句能够卸载经过INSTALL PLUGIN或者PLUGIN-LOAD方式加载的插件。可是不能卸载内置插件(INFORMATION_SCHEMA.PLUGINS表PLUGIN_LIBRARY字段为NULL的插件),也不能卸载INFORMATION_SCHEMA.PLUGINS表load_option字段为FORCE_PLUS_PERMANENT的插件。
注:在卸载经过PLUGIN-LOAD方式加载的插件时,注意要将my.cnf配置文件中相关配置删除,不然下次启动时仍然会加载该插件。
查看插件信息
SHOW PLUGINS
INFORMATION_SCHEMA.PLUGINS
MYSQL.PLUGIN