1.配置my.ini檔案
#加密插件
early-plugin-load=keyring_file.dll
#生成key的路徑
keyring_file_data=D:\mysql-8.0.18-winx64\key
2.檢視keyring插件是否生效
登陸mysql mysql -u root -proot
use test;
show plugins;或select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'keyring%'
3.檢視參數innodb_file_per_table參數是否打開,是否是獨立表空間(即一張表對應一個表空間)
show variables like '%per_table%';(ON表示打開,OFF表示關閉)
更改參數innodb_file_per_table
set global innodb_file_per_table=OFF(關)
set global innodb_file_per_table=ON(開)
4.建立加密表空間
alter table country encryption='Y';
5.取消加密表空間
alter table country encryption='N'
6.定期更改master key的指令
alter instance rotate innodb master key;