Components provide expanded access to MySQL Enterprise Data Masking 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 data_masking plugin
        and all of its loadable functions to avoid conflicts. For
        instructions, see
        Section 8.5.3.1, “MySQL Enterprise Data Masking Plugin Installation”.
      
MySQL Enterprise Data Masking database table and components are:
- masking_dictionariestable- Purpose: A table that provides persistent storage for masking dictionaries and terms. While the - mysqlsystem 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:- The - mysqlsystem schema is not backed up by a logical backup, such as mysqldump or load operations.
- A dedicated schema makes outbound replication easier. 
- A user or role requires no - mysqlschema privileges when preforming related data-masking tasks in the dedicated schema.
 
- component_maskingcomponent- Purpose: The component implements the core of the masking functionality and exposes it as services. - URN: - file://component_masking
- component_masking_functionscomponent- Purpose: The component exposes all functionality of the - component_maskingcomponent as loadable functions. Some of the functions require the- MASKING_DICTIONARIES_ADMINdynamic privilege.- URN: - file://component_masking_functions
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 Section 7.5.2, “Obtaining Component Information”. For general information about installing or uninstalling components, see Section 7.5.1, “Installing and Uninstalling Components”.
MySQL Enterprise Data Masking supports these setup and removal procedures:
Consider using a dedicated schema to store data-masking dictionaries (see Install Using a Dedicated Schema).
To set up MySQL Enterprise Data Masking:
- Run - masking_functions_install.sqlto add the- masking_dictionariestable to the- mysqlschema and install the components. The script is located in the- sharedirectory of your MySQL installation.- $> mysql -u root -p -D mysql < [path/]masking_functions_install.sql Enter password: (enter root password here)
To set up MySQL Enterprise Data Masking:
- Create a database to store the - masking_dictionariestable. For example, to use- mask_dbas the database name, execute this statement:- $> mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS mask_db" Enter password: (enter root password here)
- Run - masking_functions_install.sqlto add the- masking_dictionariestable to the- mask_dbschema and install the components. The script is located in the- sharedirectory of your MySQL installation.- $> mysql -u root -p -D mask_db < [path/]masking_functions_install.sql Enter password: (enter root password here)
- Set and persist the - mask_dbschema at startup by preceding the- component_masking.masking_databaseread-only variable name by the- PERSIST_ONLYkeyword.- $> mysql -u root -p -e "SET PERSIST_ONLY component_masking.masking_database=mask_db" Enter password: (enter root password here)- After modifying the variable, restart the server to cause the new setting to take effect. 
          To remove MySQL Enterprise Data Masking when using the mysql
          system schema:
- Run - masking_functions_uninstall.sqlto remove the- masking_dictionariestable from the appropriate schema and uninstall the components. The script is located in the- sharedirectory of your MySQL installation. The example here specifies the- mysqldatabase.- $> mysql -u root -p -D mysql < [path/]masking_functions_uninstall.sql Enter password: (enter root password here)
To remove MySQL Enterprise Data Masking when using a dedicated schema:
- Run - masking_functions_uninstall.sqlto remove the- masking_dictionariestable from the appropriate schema and uninstall the components. The script is located in the- sharedirectory of your MySQL installation. The example here specifies the- mask_dbdatabase.- $> mysql -u root -p -D mask_db < [path/]masking_functions_uninstall.sql Enter password: (enter root password here)
- Stop persisting the - component_masking.masking_databasevariable.- $> mysql -u root -p -e "RESET PERSIST component_masking.masking_database" Enter password: (enter root password here)
- [Optional] Drop the dedicated schema to ensure that it is not used for other purposes. - DROP DATABASE mask_db;