首页 文章

MariaDB / MySQL表加密无需重启

提问于
浏览
0

通过遵循this文章中的步骤,我成功地设置了MariaDb 10.1.14加密数据 . 但我必须重新启动服务器以使其正常工作 . 我希望无需重启即可实现加密 . 所以我做了以下步骤:

  • 安装MariaDb

  • 确保服务正在运行

进行ecryption所需的ini更改

plugin_load_add = file_key_management

file_key_management_filename = C:\Program Files\MariaDB 10.1\data\myKey.enc

file_key_management_filekey = FILE:<UserProfileFolder>\myPwd.key

file_key_management_encryption_algorithm = aes_cbc

innodb_encrypt_tables = ON

innodb_encrypt_log = ON

innodb_tablespaces_encryption = ON

innodb_encryption_threads = 4

跑sql来激活加密插件

install plugin FILE_KEY_MANAGEMENT soname 'file_key_management';

SET GLOBAL innodb_encrypt_tables=ON;

SET GLOBAL innodb_encryption_threads=4;
  • 设置完所有后,加密没有开始

  • 我发现我必须手动运行alter table语句才能对所有现有表启用加密,我不知道如何在没有重启的情况下为Redologs和Tablespaces做到这一点,但是 I don't have to do this if I restart the service .

如果有任何指导,我将非常感激 .

1 回答

  • 0

    感谢您的回复,但我发现确实触发了表的加密而没有重新启动 . 当我运行查询以激活加密插件时,又向其添加了一个查询

    SELECT count(*) FROM information_schema.innodb_tablespaces_encryption where ENCRYPTION_SCHEME = 1;

    这个查询真的很神奇 . 因此,似乎一旦加密插件被激活,需要检查information_schema.innodb_tablespaces_encryption,这将使插件生效 .

    但仍有一点需要注意,它不会加密日志,因为innodb_encrypt_log全局变量是只读的 .

相关问题