![在 CentOS 7.5 上启用 MariaDB 的文件密钥插件](https://linux22.com/image/726265/%E5%9C%A8%20CentOS%207.5%20%E4%B8%8A%E5%90%AF%E7%94%A8%20MariaDB%20%E7%9A%84%E6%96%87%E4%BB%B6%E5%AF%86%E9%92%A5%E6%8F%92%E4%BB%B6.png)
我正在尝试在 MariaDB 上启用 file_key_management。
我正在使用 CentOS 7.5 和 MariaDB 15.1。
以下是 centos-release:
CentOS Linux 版本 7.5.1804(核心)
MariaDB 版本:
Ver 15.1 发行版 5.5.60-MariaDB
我已经使用以下命令来准备密钥:
openssl rand -hex 16 >> /etc/mysql/keys
openssl rand -hex 16 >> /etc/mysql/keys
openssl rand -hex 16 >> /etc/mysql/keys
chown mysql:mysql /etc/mysql/keys
chmod 400 /etc/mysql/keys
之后,我将etc/mysql/keys
文件编辑为以下格式:
1;key_1
2;key_2
3;key_3
我etc/mysql/keys
使用 加密了文件openssl enc -aes-256-cbc -md sha1 -k "password" -in /etc/mysql/keys -out /etc/mysql/keys.enc
。最后,我将my.cnf
文件编辑如下:
[mysqld]
...
# File Key Management
plugin_load_add = file_key_management
file_key_management_filename = /etc/mysql/keys.enc
file_key_management_filekey = FILE:/etc/mysql/.key
file_key_management_encryption_algorithm = aes_cbc
[mysqld_safe]
...
完成所有这些之后,当我重新启动 mariadb 服务时,它会显示以下内容:
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details
这是 MariaDB 日志:
180826 17:06:19 InnoDB: highest supported file format is Barracuda.
180826 17:06:19 InnoDB: Waiting for the background threads to start
180826 17:06:20 Percona XtraDB (http://www.percona.com) 5.5.59-MariaDB-38.11 started; log sequence number 429373685
180826 17:06:20 [Note] Plugin 'FEEDBACK' is disabled.
180826 17:06:20 [ERROR] Can't open shared library '/usr/lib64/mysql/plugin/file_key_management.so' (errno: 17, cannot open shared object file: No such file or directory)
180826 17:06:20 [ERROR] Couldn't load plugins from 'file_key_management.so'.
180826 17:06:20 server_audit: MariaDB Audit Plugin version 1.4.3 STARTED.
180826 17:06:20 [ERROR] /usr/libexec/mysqld: unknown variable 'file_key_management_filename=/etc/mysql/keys.enc'
180826 17:06:20 [ERROR] Aborting
180826 17:06:20 server_audit: STOPPED
180826 17:06:20 InnoDB: Starting shutdown...
180826 17:06:24 InnoDB: Shutdown completed; log sequence number 429373685
180826 17:06:24 [Note] /usr/libexec/mysqld: Shutdown complete
180826 17:06:24 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
我找不到如何下载file_key_management.so
文件以使用它。有人能帮我找到解决方案吗?提前谢谢。