开启TDE后mysqldump使用

环境:

mysql:5.7.39-log

 

导出加密表
/opt/mysql57/bin/mysqldump -h localhost -uroot -pmysql -P13306 --default-character-set=utf8 --hex-blob --set-gtid-purged=OFF -S /opt/mysql57/data/mysql.sock db_test tb_tde>/tmp/tb_tde.dump

 

导入到无加密环境的库下
/opt/mysql57/bin/mysql -h localhost -uroot -pyeemiao1117 --default-character-set=utf8 -S /opt/mysql57/data/mysql.sock -D db_test</tmp/tb_tde.dump

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 3185 (HY000) at line 25: Can't find master key from keyring, please check in the server log if a keyring plugin is loaded and initialized successfully.

报错误 

 

导入到开启了TDE的环境
/opt/mysql57/bin/mysql -h localhost -uroot -pmysql --default-character-set=utf8 -S /opt/mysql57/data/mysql.sock -D db_test</tmp/tb_tde.dump

 成功

 

结论:mysqldump备份文件可以还原到开启加密插件的mysql实例上,自动生成master key,但是不能导入到没有开启TDE的环境

posted @ 2024-12-27 09:01  slnngk  阅读(2)  评论(0编辑  收藏  举报