元件提供對 MySQL Enterprise 資料遮罩和去識別功能的擴展存取。先前,MySQL 將遮罩和去識別功能實作為包含外掛程式和數個可載入函數的外掛程式程式庫檔案。在您開始元件安裝之前,請移除 data_masking
外掛程式及其所有可載入函數,以避免衝突。如需說明,請參閱第 8.5.3.1 節「MySQL Enterprise 資料遮罩和去識別外掛程式安裝」。
MySQL Enterprise 資料遮罩和去識別資料庫表格和元件為
masking_dictionaries
表格用途:此表格提供遮罩字典和術語的永久儲存。雖然
mysql
系統綱要為傳統儲存選項,但也允許為此目的建立專用綱要。基於以下原因,專用綱要可能更合適mysql
系統綱要不會由邏輯備份(例如 mysqldump)或載入操作備份。專用綱要可讓對外複寫更輕鬆。
使用者或角色在專用綱要中執行相關的資料遮罩工作時,不需要
mysql
綱要權限。
component_masking
元件用途:此元件實作遮罩功能的核心,並將其公開為服務。
URN:
file://component_masking
component_masking_functions
元件用途:此元件將
component_masking
元件的所有功能公開為可載入的函數。部分函數需要MASKING_DICTIONARIES_ADMIN
動態權限。URN:
file://component_masking_functions
如果在複寫來源伺服器上使用元件和函數,請將其安裝在所有複本伺服器上,以避免複寫問題。載入元件時,關於它們的資訊可如第 7.5.2 節「取得元件資訊」中所述取得。如需關於安裝或解除安裝元件的一般資訊,請參閱第 7.5.1 節「安裝和解除安裝元件」。
MySQL Enterprise 資料遮罩和去識別支援以下設定和移除程序
考慮使用專用綱要來儲存資料遮罩字典(請參閱使用專用綱要安裝)。
設定 MySQL Enterprise 資料遮罩和去識別
執行
masking_functions_install.sql
,將masking_dictionaries
表格新增至mysql
綱要並安裝元件。此指令碼位於您 MySQL 安裝的share
目錄中。$> mysql -u root -p -D mysql < [path/]masking_functions_install.sql Enter password: (enter root password here)
設定 MySQL Enterprise 資料遮罩和去識別
建立一個資料庫來儲存
masking_dictionaries
表格。例如,若要使用mask_db
作為資料庫名稱,請執行此陳述式$> mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS mask_db" Enter password: (enter root password here)
執行
masking_functions_install.sql
以將masking_dictionaries
表格新增至mask_db
結構描述,並安裝元件。此腳本位於您 MySQL 安裝的share
目錄中。$> mysql -u root -p -D mask_db < [path/]masking_functions_install.sql Enter password: (enter root password here)
在啟動時,透過在唯讀變數名稱
component_masking.masking_database
前面加上PERSIST_ONLY
關鍵字,來設定並永久保存mask_db
結構描述。$> mysql -u root -p -e "SET PERSIST_ONLY component_masking.masking_database=mask_db" Enter password: (enter root password here)
修改變數後,重新啟動伺服器以使新設定生效。
當使用 mysql
系統結構描述時,移除 MySQL Enterprise Data Masking and De-Identification 的步驟
執行
masking_functions_uninstall.sql
以從適當的結構描述移除masking_dictionaries
表格並解除安裝元件。此腳本位於您 MySQL 安裝的share
目錄中。此處的範例指定mysql
資料庫。$> mysql -u root -p -D mysql < [path/]masking_functions_uninstall.sql Enter password: (enter root password here)
當使用專用結構描述時,移除 MySQL Enterprise Data Masking and De-Identification 的步驟
執行
masking_functions_uninstall.sql
以從適當的結構描述移除masking_dictionaries
表格並解除安裝元件。此腳本位於您 MySQL 安裝的share
目錄中。此處的範例指定mask_db
資料庫。$> mysql -u root -p -D mask_db < [path/]masking_functions_uninstall.sql Enter password: (enter root password here)
停止永久保存
component_masking.masking_database
變數。$> mysql -u root -p -e "RESET PERSIST component_masking.masking_database" Enter password: (enter root password here)
[選用] 刪除專用結構描述,以確保其不被用於其他目的。
DROP DATABASE mask_db;