18.11.1 可插拔存储引擎架构
MySQL Server uses a pluggable storage engine architecture that enables storage engines to be loaded into and unloaded from a running MySQL server.
Plugging in a Storage Engine
Before a storage engine can be used, the storage engine plugin shared library must be loaded into MySQL using the INSTALL PLUGIN
statement. For example, if the EXAMPLE
engine plugin is named example
and the shared library is named ha_example.so
, you load it with the following statement:
INSTALL PLUGIN example SONAME 'ha_example.so';
To install a pluggable storage engine, the plugin file must be located in the MySQL plugin directory, and the user issuing the INSTALL PLUGIN
statement must have INSERT
privilege for the mysql.plugin
table.
The shared library must be located in the MySQL server plugin directory, the location of which is given by the plugin_dir
system variable.
Unplugging a Storage Engine
To unplug a storage engine, use the UNINSTALL PLUGIN
statement:
UNINSTALL PLUGIN example;
If you unplug a storage engine that is needed by existing tables, those tables become inaccessible, but are still present on disk (where applicable). Ensure that there are no tables using a storage engine before you unplug the storage engine.