一、下载插件
https://bintray.com/mcafee/mysql-audit-plugin/release/1.1.7-805#files
解压的内容如图:
二、执行offset-extract.sh脚本,参数是mysqld全路径
三、修改my.cnf配置
[mysqld]
plugin-load=AUDIT=libaudit_plugin.so
audit_offsets=7824, 7872, 3632, 4792, 456, 360, 0, 32, 64, 160, 536, 7988, 4360, 3648, 3656, 3660, 6072, 2072, 8, 7056, 7096, 7080, 13472, 148, 672
audit_json_file=1
四、重启mysql
五、查询插件安装情况
1、show plugins;
2、show status like "%audit%";
3、show variables like "%audit%";
如果audit_json_file为OFF,则需要执行set global audit_json_file=1打开审计文件
六、检查审计文件内容
审计文件位置:/usr/local/mysql/data/mysql-audit.json
去看一下文件是否生成,并且检查一下里面内容。