<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="ddl-rewriter-installation">
      </a>
      7.6.5.1 Installing or Uninstalling ddl_rewriter
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045256199952">
  </a>
  <a class="indexterm" name="idm46045256198464">
  </a>
  <p>
   This section describes how to install or uninstall the
   <code class="literal">
    ddl_rewriter
   </code>
   plugin. For general information
        about installing plugins, see
   <a class="xref" href="plugin-loading.html" title="7.6.1 Installing and Uninstalling Plugins">
    Section 7.6.1, “Installing and Uninstalling Plugins”
   </a>
   .
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    If installed, the
    <code class="literal">
     ddl_rewriter
    </code>
    plugin
          involves some minimal overhead even when disabled. To avoid
          this overhead, install
    <code class="literal">
     ddl_rewriter
    </code>
    only
          for the period during which you intend to use it.
   </p>
   <p>
    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.
   </p>
  </div>
  <p>
   To be usable by the server, the plugin library file must be
        located in the MySQL plugin directory (the directory named by
        the
   <a class="link" href="server-system-variables.html#sysvar_plugin_dir">
    <code class="literal">
     plugin_dir
    </code>
   </a>
   system
        variable). If necessary, configure the plugin directory location
        by setting the value of
   <a class="link" href="server-system-variables.html#sysvar_plugin_dir">
    <code class="literal">
     plugin_dir
    </code>
   </a>
   at server startup.
  </p>
  <p>
   The plugin library file base name is
   <code class="literal">
    ddl_rewriter
   </code>
   . The file name suffix differs
        per platform (for example,
   <code class="filename">
    .so
   </code>
   for Unix and
        Unix-like systems,
   <code class="filename">
    .dll
   </code>
   for Windows).
  </p>
  <p>
   To install the
   <code class="literal">
    ddl_rewriter
   </code>
   plugin, use the
   <a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
    <code class="literal">
     INSTALL PLUGIN
    </code>
   </a>
   statement,
        adjusting the
   <code class="filename">
    .so
   </code>
   suffix for your platform
        as necessary:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87064916"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> ddl_rewriter <span class="token keyword">SONAME</span> <span class="token string">'ddl_rewriter.so'</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   To verify plugin installation, examine the Information Schema
   <a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
    <code class="literal">
     PLUGINS
    </code>
   </a>
   table or use the
   <a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
    <code class="literal">
     SHOW PLUGINS
    </code>
   </a>
   statement (see
   <a class="xref" href="obtaining-plugin-information.html" title="7.6.2 Obtaining Server Plugin Information">
    Section 7.6.2, “Obtaining Server Plugin Information”
   </a>
   ). For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40504707"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> PLUGIN_NAME<span class="token punctuation">,</span> PLUGIN_STATUS<span class="token punctuation">,</span> PLUGIN_TYPE
       <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PLUGINS</span>
       <span class="token keyword">WHERE</span> PLUGIN_NAME <span class="token operator">LIKE</span> <span class="token string">'ddl%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PLUGIN_NAME  <span class="token punctuation">|</span> PLUGIN_STATUS <span class="token punctuation">|</span> PLUGIN_TYPE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_rewriter <span class="token punctuation">|</span> ACTIVE        <span class="token punctuation">|</span> AUDIT       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <p>
   As the preceding result shows,
   <code class="literal">
    ddl_rewriter
   </code>
   is implemented as an audit plugin.
  </p>
  <p>
   If the plugin fails to initialize, check the server error log
        for diagnostic messages.
  </p>
  <p>
   Once installed as just described,
   <code class="literal">
    ddl_rewriter
   </code>
   remains installed until
        uninstalled. To remove it, use
   <a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
    <code class="literal">
     UNINSTALL
        PLUGIN
    </code>
   </a>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53160038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UNINSTALL</span> <span class="token keyword">PLUGIN</span> ddl_rewriter<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   If
   <code class="literal">
    ddl_rewriter
   </code>
   is installed, you can use the
   <a class="link" href="ddl-rewriter-options.html#option_mysqld_ddl-rewriter">
    <code class="option">
     --ddl-rewriter
    </code>
   </a>
   option for
        subsequent server startups to control
   <code class="literal">
    ddl_rewriter
   </code>
   plugin activation. For example,
        to prevent the plugin from being enabled at runtime, use this
        option:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84715393"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">ddl-rewriter</span><span class="token attr-value"><span class="token punctuation">=</span>OFF</span></code></pre>
  </div>
 </div>
 <br/>
</div>
