因为MySQL社区版本没有自带审计功能,所以基于MySQL8.0.33版本容器运行的MySQL自行安装插件
1.查看Mysql是否安装过audit_log插件
SELECT * FROM information_schema.PLUGINS WHERE PLUGIN_NAME LIKE '%audit%';
2.下载Percona Server for MySQL,地址为 Install with binary tarballs - Percona Server for MySQL
- tar -xvf Percona-Server-8.0.33-25-Linux.x86_64.glibc2.17-minimal.tar.gz
- cd Percona-Server-8.0.33-25-Linux.x86_64.glibc2.17-minimal/lib/plugin
- #复制插件audit_log.so到容器内mysql插件目录
- docker cp audit_log.so ca92879e02a9:/usr/lib64/mysql/plugin/
3.安装插件
install plugin audit_log soname 'audit_log.so';
4.添加配置,在my.cnf中[mysqld]里面添加
- plugin-load = audit_log.so
- audit_log_file = /var/lib/mysql/audit.log
- audit_log_format = JSON
- audit_log_policy = ALL
- audit_log_handler = FILE
- audit_log_rotate_on_size = 1048576
5.重启MySQL容器
docker restart ca92879e02a9
标签:audit,插件,log,33,Percona,版本,MySQL From: https://www.cnblogs.com/fanwenyan/p/18218033