MySQL 企业版 TDE加密后 测试和问题汇总

ops/2025/3/17 2:20:41/

一、测试keyring file
1.1 当keyring file文件丢失或者被篡改

结论:不影响当前正在运行的数据库,但是在重启服务后会启动失败出现报错。

tail -n 100 /var/log/mysql/error.log

报错信息如下:

2025-03-12T08:04:54.668847Z 1 [ERROR] [MY-012657] [InnoDB] Encryption can't find master key, please check the keyring is loaded.
2025-03-12T08:04:54.668873Z 1 [ERROR] [MY-012226] [InnoDB] Encryption information in datafile: ./aptool/country.ibd can't be decrypted, please confirm that keyring is loaded.
2025-03-12T08:04:54.669509Z 1 [ERROR] [MY-012657] [InnoDB] Encryption can't find master key, please check the keyring is loaded.
2025-03-12T08:04:54.669529Z 1 [ERROR] [MY-012226] [InnoDB] Encryption information in datafile: ./aptool/filedownload.ibd can't be decrypted, please confirm that keyring is loaded.
2025-03-12T08:04:54.669998Z 1 [ERROR] [MY-012657] [InnoDB] Encryption can't find master key, please check the keyring is loaded.
2025-03-12T08:04:54.670012Z 1 [ERROR] [MY-012226] [InnoDB] Encryption information in datafile: ./aptool/fileupload.ibd can't be decrypted, please confirm that keyring is loaded.
2025-03-12T08:04:54.670605Z 1 [ERROR] [MY-012657] [InnoDB] Encryption can't find master key, please check the keyring is loaded.
2025-03-12T08:04:54.670618Z 1 [ERROR] [MY-012226] [InnoDB] Encryption information in datafile: ./aptool/imaging.ibd can't be decrypted, please confirm that keyring is loaded.
2025-03-12T08:04:54.671389Z 1 [ERROR] [MY-012657] [InnoDB] Encryption can't find master key, please check the keyring is loaded.
2025-03-12T08:04:54.671402Z 1 [ERROR] [MY-012226] [InnoDB] Encryption information in datafile: ./aptool/vendor_mgt.ibd can't be decrypted, please confirm that keyring is loaded.
2025-03-12T08:04:54.702825Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702848Z 0 [Warning] [MY-013434] [Server] Plugin audit_log reported: 'Invalid audit log file content: '/var/log/mysql/audit.20250311T063025.log.20250311T062553-1.enc''
2025-03-12T08:04:54.702863Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702868Z 0 [Warning] [MY-013434] [Server] Plugin audit_log reported: 'Invalid audit log file content: '/var/log/mysql/audit.20250311T063911.log.20250311T063025-1.enc''
2025-03-12T08:04:54.702879Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702883Z 0 [Warning] [MY-013434] [Server] Plugin audit_log reported: 'Invalid audit log file content: '/var/log/mysql/audit.20250311T065904.log.20250311T063911-1.enc''
2025-03-12T08:04:54.702894Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702898Z 0 [Warning] [MY-013434] [Server] Plugin audit_log reported: 'Invalid audit log file content: '/var/log/mysql/audit.20250311T071525.log.20250311T063911-1.enc''
2025-03-12T08:04:54.702908Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702912Z 0 [Warning] [MY-013434] [Server] Plugin audit_log reported: 'Invalid audit log file content: '/var/log/mysql/audit.20250312T080452.log.20250311T063911-1.enc''
2025-03-12T08:04:54.702928Z 0 [ERROR] [MY-013159] [Server] Plugin audit_log reported: 'No keyring installed.'
2025-03-12T08:04:54.702942Z 0 [ERROR] [MY-010202] [Server] Plugin 'audit_log' init function returned error.
2025-03-12T08:04:54.702947Z 0 [ERROR] [MY-010734] [Server] Plugin 'audit_log' registration as a AUDIT failed.
2025-03-12T08:04:54.703521Z 0 [ERROR] [MY-010169] [Server] Failed to initialize dynamic plugins.
2025-03-12T08:04:54.703535Z 0 [ERROR] [MY-010119] [Server] Aborting

将备份的keyring file文件还原,重新启动服务后,数据库启动正常,原来加密的表正常。说明定期备份keyring file文件很重要。

三、测试mysqldump备份文件

模拟文件被泄漏。对启用TDE加密的数据库(某些表加密)执行mysqldump逻辑备份。将mysqldump文件拷贝到其他mysql服务器上执行导入测试

3.1 在未启用加密插件的MySQL上导入备份

在未启用加密插件的mysql示例上(我测试社区版),导入备份文件报错且数据库和表都未创建。

mysql > ERROR 3185 (HY000) at line 27: Can't find master key from keyring, please check in the server log if a keyring plugin is loaded and initialized successfully.Operation failed with exitcode 1

通过notepad打开mysqldump文件,我们可以看到创建表的SQL语句含有ENCRYPTION='Y'加密操作,没有启用TDE的情况下加上这句肯定会报错,我们将文件里面的ENCRYPTION='Y'都使用空替换,重新保存mysqldump文件。

重新导入新的mysqldump文件,经过测试成功,数据库和表都成功创建。

总结:这说明mysqldump文件是明文内容,没有加密,我们去掉创建表时的加密语句后仍然可以在没有TDE的情况下导入到其他MySQL实例上读取数据。

3.2 在已启用加密插件的mysql实例上导入备份

在已启用加密插件的mysql实例上,导入备份文件无报错,同时导入的表也是加密状态。

总结:mysqldump备份文件可以还原到开启加密插件的mysql实例上,并自动生成master key。


http://www.ppmy.cn/ops/166374.html

相关文章

介绍HTTP协议基本结构与Linux中基本实现HTTPServer

介绍HTTP协议基本结构与基本实现HTTPServer HTTP协议 前面已经了解了协议的重要性并且已经定义了属于我们自己的协议,但是在网络中,已经有一些成熟的协议,最常用的就是HTTP协议 在互联网世界中,HTTP(HyperText Tran…

如何在androidstudio开发环境中查看sqlite数据库(按新版本Android Studio Giraffe提供详细步骤和操作说明,附截图,代码)

如何在androidstudio开发环境中查看sqlite数据库(按新版本Android Studio Giraffe提供详细步骤和操作说明,附截图,代码)鹿溪IT工作室提供_android studio查看数据库-CSDN博客

简单以太网配置

display arp //查看路由器mac地址 交换机配置命令: system-view // 从用户视图进入系统视图 dis mac-address //查看mac地址表 路由器配置命令: system-view // 从用户视图进入系统视图 int GigabitEthernet 0/0/0 //进入G口 0/0/0 进入之后配置网关: ip addre…

贪心算法和遗传算法优劣对比——c#

项目背景:某钢管厂的钢筋原材料为 55米,工作需要需切割 40 米(1段)、11 米(15 段)等 4 种规格 ,现用贪心算法和遗传算法两种算法进行计算: 第一局:{ 40, 1 }, { 11, 15…

设计模式-工厂模式、策略模式、代理模式、责任链模式

目录 1 工厂模式 1.1 简单工厂模式 1.2 工厂方法模式 1.3 抽象工厂模式 1.4 工厂模式适用的场合 1.5 三种工厂模式的使用选择 2 策略模式 2.1 定义 2.2 结构 3 代理模式 3.1 啥是代理模式 3.2 为啥要用代理模式 3.3 代理模式分类 3.3.1 静态代理 3.3.2 动态代理…

Pyecharts 输出到 html 白屏 | 解决方案来

方法一: 先去文件夹里面打开你的html文件,有时候直接在edge浏览器打不开 跑去文件夹中打开 方法二: 尝试以上还不行之后, 1.在同级目录下创建文件:echarts.min.js (一定要右键创建) 2.创建成…

使用 Java 获取咸鱼(微店)商品详情接口(micro.item_get)的完整指南

在电商领域,获取商品详情数据是实现商品推荐、数据分析和用户体验优化的重要基础。本文将详细介绍如何使用 Java 编写程序,通过微店的 micro.item_get 接口获取商品详情数据。我们将使用 HttpClient 发送 HTTP 请求,并通过 JSON 解析工具处理…

实现图形界面访问无显示器服务器

SSH 端口转发 VNC 一般租用的服务器有端口限制,而且可选镜像一般是无桌面环境,原始只支持ssh连接,对于机器人仿真肯定是要看图形界面的,记录一个实现图形界面访问无显示器服务器方法。 1. 在服务器端安装并配置 VNC # 安装桌面…