Skip to content

Instantly share code, notes, and snippets.

@yangl
Created February 6, 2018 08:54
Show Gist options
  • Select an option

  • Save yangl/6e523a5739cf152c3c440e8e0c35d552 to your computer and use it in GitHub Desktop.

Select an option

Save yangl/6e523a5739cf152c3c440e8e0c35d552 to your computer and use it in GitHub Desktop.
MariaDB Audit Plugin MySQL审计日志 https://mariadb.com/kb/en/library/mariadb-audit-plugin/
1.查看plugin的目录所在,确认存在server_audit.so / server_audit.dll:
SHOW GLOBAL VARIABLES LIKE 'plugin_dir';
+---------------+--------------------------+
| Variable_name | Value |
+---------------+--------------------------+
| plugin_dir | /usr/lib64/mysql/plugin/ |
+---------------+--------------------------+
2.在MySQL配置文件my.ini的mysqld下添加
plugin_load=server_audit=server_audit.dll
server_audit_events=CONNECT,QUERY,TABLE,QUERY_DDL,QUERY_DML,QUERY_DCL
server_audit_file_rotate_size=10G
server_audit_logging=ON
3.重启MySQL服务
执行:
SHOW GLOBAL VARIABLES LIKE 'server_audit%';
开启:
SET GLOBAL server_audit_logging=ON;
关闭:
SET GLOBAL server_audit_logging=OFF;
详见:
https://mariadb.com/kb/en/library/mariadb-audit-plugin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment