7.6.5.1 安装或卸载 ddl_rewriter
This section describes how to install or uninstall the ddl_rewriter
plugin. For general information about installing plugins, see Section 7.6.1, “Installing and Uninstalling Plugins”.
If installed, the ddl_rewriter
plugin involves some minimal overhead even when disabled. To avoid this overhead, install ddl_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 the plugin_dir
system variable). If necessary, configure the plugin directory location by setting the value of plugin_dir
at server startup.
The plugin library file base name is ddl_rewriter
. The file name suffix differs per platform (for example, .so
for Unix and Unix-like systems, .dll
for Windows).
To install the ddl_rewriter
plugin, use the INSTALL PLUGIN
statement, adjusting the .so
suffix for your platform as necessary:
INSTALL PLUGIN ddl_rewriter SONAME 'ddl_rewriter.so';
To verify plugin installation, examine the Information Schema PLUGINS
table or use the SHOW PLUGINS
statement (see Section 7.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, use UNINSTALL PLUGIN
:
UNINSTALL PLUGIN ddl_rewriter;
If ddl_rewriter
is installed, you can use the --ddl-rewriter
option for subsequent server startups to control ddl_rewriter
plugin activation. For example, to prevent the plugin from being enabled at runtime, use this option:
[mysqld]
ddl-rewriter=OFF