# Data masking
This feature was implemented in *Percona Server for MySQL* version Percona Server for MySQL 8.0.17-8.
The Percona Data Masking plugin is a free and Open Source implementation of the
*MySQL*’s data masking plugin. Data Masking provides a set of functions to hide
sensitive data with modified content.
Data masking can have either of the characteristics:
* Generation of random data, such as an email address
* De-identify data by transforming the data to hide content
### Installing the plugin
The following command installs the plugin:
```{.bash data-prompt="$"}
$ INSTALL PLUGIN data_masking SONAME 'data_masking.so';
```
### Data masking functions
The data masking functions have the following categories:
* General purpose
* Special purpose
* Generating Random Data with Defined characteristics
* Using Dictionaries to Generate Random Data
### General purpose
The general purpose data masking functions are the following:
Parameter |
Description |
Returns |
gen_blacklist(str, dictionary_name, replacement_dictionary_name) |
Replaces a term with a term from a second dictionary. |
A dictionary term |
gen_dictionary(dictionary_name) |
Randomizes the dictionary terms |
A random term from the selected dictionary. |
gen_dictionary_drop(dictionary_name) |
Removes the selected dictionary from the dictionary registry. |
Either success or failure |
gen_dictionary_load(dictionary path, dictionary name) |
Loads a file into the dictionary registry and configures the dictionary name. The name can be used with any function. If the dictionary is edited, you must drop and then reload the dictionary to view the changes. |
Either success or failure |
#### Example
An example of `gen_blacklist()`:
```{.bash data-prompt="mysql>"}
mysql> SELECT gen_blacklist('apple', 'fruit', 'nut');
```
??? example "Expected output"
```{.text .no-copy}
+-----------------------------------------+
| gen_blacklist('apple', 'fruit', 'nut') |
+-----------------------------------------+
| walnut |
+-----------------------------------------+
```
An example of `gen_dictionary()`:
```{.bash data-prompt="mysql>"}
mysql> SELECT gen_dictionary('trees');
```
??? example "Expected output"
```{.text .no-copy}
+--------------------------------------------------+
| gen_dictionary('trees') |
+--------------------------------------------------+
| Norway spruce |
+--------------------------------------------------+
```
An example of `gen_dictionary_drop()`:
```{.bash data-prompt="mysql>"}
mysql> SELECT gen_dictionary_drop('mytestdict')
```
??? example "Expected output"
```{.text .no-copy}
+-------------------------------------+
| gen_dictionary_drop('mytestdict') |
+-------------------------------------+
| Dictionary removed |
+-------------------------------------+
```
An example of `gen_dictionary_load(path, name)`:
```{.bash data-prompt="mysql>"}
mysql> SELECT gen_dictionary_load('/usr/local/mysql/dict-files/testdict', 'testdict');
```
??? example "Expected output"
```{.text .no-copy}
+-------------------------------------------------------------------------------+
| gen_dictionary_load('/usr/local/mysql/mysql/dict-files/testdict', 'testdict') |
+-------------------------------------------------------------------------------+
| Dictionary load successfully |
+-------------------------------------------------------------------------------+
```
### Uninstalling the plugin
The [UNINSTALL PLUGIN](https://dev.mysql.com/doc/refman/8.0/en/uninstall-plugin.html) statement disables and uninstalls the plugin.