天天看点

mysql8.0加密

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;

继续阅读