<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="firewall-installation">
      </a>
      8.4.7.2 Installing or Uninstalling MySQL Enterprise Firewall
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045234591088">
  </a>
  <a class="indexterm" name="idm46045234589616">
  </a>
  <p>
   MySQL Enterprise Firewall installation is a one-time operation that installs the
        elements described in
   <a class="xref" href="firewall-elements.html" title="8.4.7.1 Elements of MySQL Enterprise Firewall">
    Section 8.4.7.1, “Elements of MySQL Enterprise Firewall”
   </a>
   .
        Installation can be performed using a graphical interface or
        manually:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      On Windows, MySQL Configurator includes an option to enable MySQL Enterprise Firewall
            for you.
     </p>
    </li>
    <li class="listitem">
     <p>
      MySQL Workbench 6.3.4 or higher can install MySQL Enterprise Firewall, enable or
            disable an installed firewall, or uninstall the firewall.
     </p>
    </li>
    <li class="listitem">
     <p>
      Manual MySQL Enterprise Firewall installation involves running a script located
            in the
      <code class="filename">
       share
      </code>
      directory of your MySQL
            installation.
     </p>
    </li>
   </ul>
  </div>
  <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Important
   </div>
   <p>
    Read this entire section before following its instructions.
          Parts of the procedure differ depending on your environment.
   </p>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    If installed, MySQL Enterprise Firewall involves some minimal overhead even when
          disabled. To avoid this overhead, do not install the firewall
          unless you plan to use it.
   </p>
  </div>
  <p>
   For usage instructions, see
   <a class="xref" href="firewall-usage.html" title="8.4.7.3 Using MySQL Enterprise Firewall">
    Section 8.4.7.3, “Using MySQL Enterprise Firewall”
   </a>
   .
        For reference information, see
   <a class="xref" href="firewall-reference.html" title="8.4.7.4 MySQL Enterprise Firewall Reference">
    Section 8.4.7.4, “MySQL Enterprise Firewall Reference”
   </a>
   .
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="firewall-installation.html#firewall-install" title="Installing MySQL Enterprise Firewall">
       Installing MySQL Enterprise Firewall
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="firewall-installation.html#firewall-uninstall" title="Uninstalling MySQL Enterprise Firewall">
       Uninstalling MySQL Enterprise Firewall
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="firewall-install">
       </a>
       Installing MySQL Enterprise Firewall
      </h5>
     </div>
    </div>
   </div>
   <p>
    If MySQL Enterprise Firewall is already installed from an older version of MySQL,
          uninstall it using the instructions given later in this
          section and then restart your server before installing the
          current version. In this case, it is also necessary to
          register your configuration again.
   </p>
   <p>
    On Windows, you can use
    <a class="xref" href="mysql-configurator.html" title="2.3.2 Configuration: Using MySQL Configurator">
     Section 2.3.2, “Configuration: Using MySQL Configurator”
    </a>
    to install MySQL Enterprise Firewall by checking the
    <span class="guilabel">
     Enable MySQL
          Enterprise Firewall
    </span>
    check box from the
    <code class="literal">
     Type and Networking
    </code>
    tab. (
    <span class="guilabel">
     Open
          Firewall port for network access
    </span>
    has a different
          purpose. It refers to Windows Firewall and controls whether
          Windows blocks the TCP/IP port on which the MySQL server
          listens for client connections.)
   </p>
   <p>
    To install MySQL Enterprise Firewall using MySQL Workbench, see
    <a class="ulink" href="/doc/workbench/en/wb-mysql-firewall.html" target="_top">
     MySQL Enterprise Firewall Interface
    </a>
    .
   </p>
   <p>
    To install MySQL Enterprise Firewall manually, look in the
    <code class="filename">
     share
    </code>
    directory of your MySQL
          installation and choose the script that is appropriate for
          your platform. The available scripts differ in the file name
          used to refer to the script:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="filename">
        win_install_firewall.sql
       </code>
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="filename">
        linux_install_firewall.sql
       </code>
      </p>
     </li>
    </ul>
   </div>
   <p>
    The installation script creates stored procedures and tables
          in the firewall database you specify when you run the script.
          The
    <code class="literal">
     mysql
    </code>
    system database is the
          traditional storage option, however, it is preferred that you
          create and use a custom schema for this purpose.
   </p>
   <p>
    To use the
    <code class="literal">
     mysql
    </code>
    system database, run the
          script as follows from the command line. The example here uses
          the Linux installation script. Make the appropriate
          substitutions for your system.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa13037783"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-D</span> mysql &lt; linux_install_firewall<span class="token punctuation">.</span>sql
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
   </div>
   <p>
    To create and use a custom schema with the script, do the
          following:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Start the server with the
       <code class="literal">
        --loose-mysql-firewall-database=
        <em class="replaceable">
         <code>
          database-name
         </code>
        </em>
       </code>
       option. Insert the name of the custom schema to be used as
              the firewall database.
      </p>
      <p>
       By prefixing the option with
       <code class="literal">
        --loose
       </code>
       ,
              the program does not emit an error and exit, but instead
              issues only a warning.
      </p>
     </li>
     <li class="listitem">
      <p>
       Invoke the MySQL client program and create the custom
              schema on the server.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa52816717"><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">CREATE</span> <span class="token keyword">DATABASE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token keyword"></span><em class="replaceable"><span class="token keyword">database</span><span class="token operator">-</span><span class="token keyword">name</span></em><span class="token keyword"></span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Run the script, naming the custom schema as the database
              for MySQL Enterprise Firewall.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa77565437"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-D</span> <em class="replaceable">database-name</em> &lt; linux_install_firewall<span class="token punctuation">.</span>sql
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
      </div>
     </li>
    </ol>
   </div>
   <p>
    Installing MySQL Enterprise Firewall either using a graphical interface or
          manually should enable the firewall. To verify that, connect
          to the server and execute this statement:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79055102"><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">SHOW</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'mysql_firewall_mode'</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>
<span class="token output"><span class="token punctuation">|</span> Variable_name       <span class="token punctuation">|</span> Value <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>
<span class="token output"><span class="token punctuation">|</span> mysql_firewall_mode <span class="token punctuation">|</span> ON    <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></code></pre>
   </div>
   <p>
    If the plugin fails to initialize, check the server error log
          for diagnostic messages.
   </p>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     To use MySQL Enterprise Firewall in the context of source/replica replication,
            Group Replication, or InnoDB Cluster, you must prepare the
            replica nodes prior to running the installation script on
            the source node. This is necessary because the
     <a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
      <code class="literal">
       INSTALL PLUGIN
      </code>
     </a>
     statements in
            the script are not replicated.
    </p>
    <div class="orderedlist">
     <ol class="orderedlist" type="1">
      <li class="listitem">
       <p>
        On each replica node, extract the
        <a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
         <code class="literal">
          INSTALL PLUGIN
         </code>
        </a>
        statements
                from the installation script and execute them manually.
       </p>
      </li>
      <li class="listitem">
       <p>
        On the source node, run the installation script as
                described previously.
       </p>
      </li>
     </ol>
    </div>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="firewall-uninstall">
       </a>
       Uninstalling MySQL Enterprise Firewall
      </h5>
     </div>
    </div>
   </div>
   <p>
    MySQL Enterprise Firewall can be uninstalled using MySQL Workbench or manually.
   </p>
   <p>
    To uninstall MySQL Enterprise Firewall using MySQL Workbench 6.3.4 or higher, see
    <a class="ulink" href="/doc/workbench/en/wb-mysql-firewall.html" target="_top">
     MySQL Enterprise Firewall Interface
    </a>
    , in
    <a class="xref" href="workbench.html" title="Chapter 33 MySQL Workbench">
     Chapter 33,
     <i>
      MySQL Workbench
     </i>
    </a>
    .
   </p>
   <p>
    To uninstall MySQL Enterprise Firewall at the command line, run the uninstall
          script located in the
    <code class="literal">
     share
    </code>
    directory of
          your MySQL installation. The example here specifies the system
          database,
    <code class="literal">
     mysql
    </code>
    .
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa52953119"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-D</span> mysql &lt; uninstall_firewall<span class="token punctuation">.</span>sql
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
   </div>
   <p>
    If you created a custom schema when you installed MySQL Enterprise Firewall, make
          the appropriate substitution for your system.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97088465"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-D</span> <em class="replaceable">database-name</em> &lt; uninstall_firewall<span class="token punctuation">.</span>sql
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
   </div>
   <p>
    This script removes the plugins, tables, functions, and stored
          procedures for MySQL Enterprise Firewall.
   </p>
  </div>
 </div>
 <br/>
</div>
