<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="data-masking-components-installation">
      </a>
      8.5.2.1 MySQL Enterprise Data Masking and De-Identification Component Installation
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045233427440">
  </a>
  <a class="indexterm" name="idm46045233425952">
  </a>
  <a class="indexterm" name="idm46045233424496">
  </a>
  <a class="indexterm" name="idm46045233423008">
  </a>
  <a class="indexterm" name="idm46045233421504">
  </a>
  <a class="indexterm" name="idm46045233420000">
  </a>
  <a class="indexterm" name="idm46045233418512">
  </a>
  <p>
   Components provide expanded access to MySQL Enterprise Data Masking and De-Identification functionality.
        Previously, MySQL implemented masking and de-identification
        capabilities as a plugin library file containing a plugin and
        several loadable functions. Before you begin the component
        installation, remove the
   <code class="literal">
    data_masking
   </code>
   plugin
        and all of its loadable functions to avoid conflicts. For
        instructions, see
   <a class="xref" href="data-masking-plugin-installation.html" title="8.5.3.1 MySQL Enterprise Data Masking and De-Identification Plugin Installation">
    Section 8.5.3.1, “MySQL Enterprise Data Masking and De-Identification Plugin Installation”
   </a>
   .
  </p>
  <p>
   MySQL Enterprise Data Masking and De-Identification database table and components are:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       masking_dictionaries
      </code>
      table
     </p>
     <p>
      Purpose: A table that provides persistent storage for
            masking dictionaries and terms. While the
      <code class="literal">
       mysql
      </code>
      system schema is the traditional
            storage option, creating a dedicated schema for this purpose
            is also permitted. A dedicated schema might be preferable
            for these reasons:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The
         <code class="literal">
          mysql
         </code>
         system schema is not backed
                up by a logical backup, such as
         <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
          <span class="command">
           <strong>
            mysqldump
           </strong>
          </span>
         </a>
         or load operations.
        </p>
       </li>
       <li class="listitem">
        <p>
         A dedicated schema makes outbound replication easier.
        </p>
       </li>
       <li class="listitem">
        <p>
         A user or role requires no
         <code class="literal">
          mysql
         </code>
         schema privileges when preforming related data-masking
                tasks in the dedicated schema.
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       component_masking
      </code>
      component
     </p>
     <p>
      Purpose: The component implements the core of the masking
            functionality and exposes it as services.
     </p>
     <p>
      URN:
      <code class="literal">
       file://component_masking
      </code>
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       component_masking_functions
      </code>
      component
     </p>
     <p>
      Purpose: The component exposes all functionality of the
      <code class="literal">
       component_masking
      </code>
      component as loadable
            functions. Some of the functions require the
      <a class="link" href="privileges-provided.html#priv_masking-dictionaries-admin">
       <code class="literal">
        MASKING_DICTIONARIES_ADMIN
       </code>
      </a>
      dynamic privilege.
     </p>
     <p>
      URN:
      <code class="literal">
       file://component_masking_functions
      </code>
     </p>
    </li>
   </ul>
  </div>
  <p>
   If the components and functions are used on a replication source
        server, install them on all replica servers as well to avoid
        replication issues. While the components are loaded, information
        about them is available as described in
   <a class="xref" href="obtaining-component-information.html" title="7.5.2 Obtaining Component Information">
    Section 7.5.2, “Obtaining Component Information”
   </a>
   . For general
        information about installing or uninstalling components, see
   <a class="xref" href="component-loading.html" title="7.5.1 Installing and Uninstalling Components">
    Section 7.5.1, “Installing and Uninstalling Components”
   </a>
   .
  </p>
  <p>
   MySQL Enterprise Data Masking and De-Identification supports these setup and removal procedures:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="data-masking-components-installation.html#data-masking-components-installation-mysql" title="Install Using the mysql System Schema">
       Install Using the mysql System Schema
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="data-masking-components-installation.html#data-masking-components-installation-dedicated" title="Install Using a Dedicated Schema">
       Install Using a Dedicated Schema
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="data-masking-components-installation.html#data-masking-components-uninstall" title="Uninstall MySQL Enterprise Data Masking and De-Identification Components">
       Uninstall MySQL Enterprise Data Masking and De-Identification Components
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="data-masking-components-installation-mysql">
       </a>
       Install Using the mysql System Schema
      </h5>
     </div>
    </div>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     Consider using a dedicated schema to store data-masking
            dictionaries (see
     <a class="xref" href="data-masking-components-installation.html#data-masking-components-installation-dedicated" title="Install Using a Dedicated Schema">
      Install Using a Dedicated Schema
     </a>
     ).
    </p>
   </div>
   <p>
    To set up MySQL Enterprise Data Masking and De-Identification:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Run
       <code class="filename">
        masking_functions_install.sql
       </code>
       to
              add the
       <code class="literal">
        masking_dictionaries
       </code>
       table to
              the
       <code class="literal">
        mysql
       </code>
       schema and install the
              components. The script is located in the
       <code class="filename">
        share
       </code>
       directory of your MySQL
              installation.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa87958442"><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; <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">[</span>path/<span class="token punctuation">]</span></em><span class="token punctuation"></span>masking_functions_install<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>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="data-masking-components-installation-dedicated">
       </a>
       Install Using a Dedicated Schema
      </h5>
     </div>
    </div>
   </div>
   <p>
    To set up MySQL Enterprise Data Masking and De-Identification:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Create a database to store the
       <code class="literal">
        masking_dictionaries
       </code>
       table. For
              example, to use
       <code class="literal">
        mask_db
       </code>
       as the database
              name, execute this statement:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61874495"><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 operator">&gt;</span> mysql <span class="token operator">-</span>u root <span class="token operator">-</span>p <span class="token operator">-</span>e <span class="token string">"CREATE DATABASE IF NOT EXISTS mask_db"</span>
Enter <span class="token keyword">password</span>: <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root <span class="token keyword">password</span> here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Run
       <code class="filename">
        masking_functions_install.sql
       </code>
       to
              add the
       <code class="literal">
        masking_dictionaries
       </code>
       table to
              the
       <code class="literal">
        mask_db
       </code>
       schema and install the
              components. The script is located in the
       <code class="filename">
        share
       </code>
       directory of your MySQL
              installation.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97517008"><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> mask_db &lt; <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">[</span>path/<span class="token punctuation">]</span></em><span class="token punctuation"></span>masking_functions_install<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>
     <li class="listitem">
      <p>
       Set and persist the
       <code class="literal">
        mask_db
       </code>
       schema at
              startup by preceding the
       <a class="link" href="data-masking-component-variables.html#sysvar_component_masking.masking_database">
        <code class="literal">
         component_masking.masking_database
        </code>
       </a>
       read-only variable name by the
       <code class="literal">
        PERSIST_ONLY
       </code>
       keyword.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36495796"><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 operator">&gt;</span> mysql <span class="token operator">-</span>u root <span class="token operator">-</span>p <span class="token operator">-</span>e <span class="token string">"SET PERSIST_ONLY component_masking.masking_database=mask_db"</span>
Enter <span class="token keyword">password</span>: <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root <span class="token keyword">password</span> here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
      </div>
      <p>
       After modifying the variable, restart the server to cause
              the new setting to take effect.
      </p>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="data-masking-components-uninstall">
       </a>
       Uninstall MySQL Enterprise Data Masking and De-Identification Components
      </h5>
     </div>
    </div>
   </div>
   <p>
    To remove MySQL Enterprise Data Masking and De-Identification when using the
    <code class="literal">
     mysql
    </code>
    system schema:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Run
       <code class="filename">
        masking_functions_uninstall.sql
       </code>
       to remove the
       <code class="literal">
        masking_dictionaries
       </code>
       table from the appropriate schema and uninstall the
              components. The script is located in the
       <code class="filename">
        share
       </code>
       directory of your MySQL
              installation. The example here specifies the
       <code class="literal">
        mysql
       </code>
       database.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa65460098"><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; <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">[</span>path/<span class="token punctuation">]</span></em><span class="token punctuation"></span>masking_functions_uninstall<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>
    To remove MySQL Enterprise Data Masking and De-Identification when using a dedicated schema:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Run
       <code class="filename">
        masking_functions_uninstall.sql
       </code>
       to remove the
       <code class="literal">
        masking_dictionaries
       </code>
       table from the appropriate schema and uninstall the
              components. The script is located in the
       <code class="filename">
        share
       </code>
       directory of your MySQL
              installation. The example here specifies the
       <code class="literal">
        mask_db
       </code>
       database.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18512510"><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> mask_db &lt; <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">[</span>path/<span class="token punctuation">]</span></em><span class="token punctuation"></span>masking_functions_uninstall<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>
     <li class="listitem">
      <p>
       Stop persisting the
       <a class="link" href="data-masking-component-variables.html#sysvar_component_masking.masking_database">
        <code class="literal">
         component_masking.masking_database
        </code>
       </a>
       variable.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66183128"><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 operator">&gt;</span> mysql <span class="token operator">-</span>u root <span class="token operator">-</span>p <span class="token operator">-</span>e <span class="token string">"RESET PERSIST component_masking.masking_database"</span>
Enter <span class="token keyword">password</span>: <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root <span class="token keyword">password</span> here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       [Optional] Drop the dedicated schema to ensure that it is
              not used for other purposes.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87374942"><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">DROP</span> <span class="token keyword">DATABASE</span> mask_db<span class="token punctuation">;</span></code></pre>
      </div>
     </li>
    </ol>
   </div>
  </div>
 </div>
 <br/>
</div>
