This section describes how to install or uninstall theddl_rewriter
plugin. For general information about installing plugins, seeSection 5.6.1, “Installing and Uninstalling Plugins”.
If installed, theddl_rewriter
plugin involves some minimal overhead even when disabled. To avoid this overhead, installddl_rewriter
only for the period during which you intend to use it.
The primary use case is modification of statements restored from dump files, so the typical usage pattern is: 1) Install the plugin; 2) restore the dump file or files; 3) uninstall the plugin.
To be usable by the server, the plugin library file must be located in the MySQL plugin directory (the directory named by theplugin_dir
system variable). If necessary, configure the plugin directory location by setting the value ofplugin_dir
at server startup.
The plugin library file base name isddl_rewriter
. The file name suffix differs per platform (for example,.so
for Unix and Unix-like systems,.dll
for Windows).
To install theddl_rewriter
plugin, use theINSTALL PLUGIN
statement, adjusting the.so
suffix for your platform as necessary:
INSTALL PLUGIN ddl_rewriter SONAME 'ddl_rewriter.so';
To verify plugin installation, examine theINFORMATION_SCHEMA.PLUGINS
表或使用SHOW PLUGINS
statement (seeSection 5.6.2, “Obtaining Server Plugin Information”). For example:
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS, PLUGIN_TYPE FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'ddl%'; +--------------+---------------+-------------+ | PLUGIN_NAME | PLUGIN_STATUS | PLUGIN_TYPE | +--------------+---------------+-------------+ | ddl_rewriter | ACTIVE | AUDIT | +--------------+---------------+-------------+
As the preceding result shows,ddl_rewriter
is implemented as an audit plugin.
If the plugin fails to initialize, check the server error log for diagnostic messages.
Once installed as just described,ddl_rewriter
remains installed until uninstalled. To remove it, useUNINSTALL PLUGIN
:
UNINSTALL PLUGIN ddl_rewriter;
Ifddl_rewriter
is installed, you can use the--ddl-rewriter
option for subsequent server startups to controlddl_rewriter
plugin activation. For example, to prevent the plugin from being enabled at runtime, use this option:
[mysqld] ddl-rewriter=OFF