#上传audit到mysql的plugin目录
vim /etc/my.cnf
plugin-load=AUDIT=libaudit_plugin.so
audit_json_file=1
audit_json_file=ON
audit_record_cmds=connect,Quit,show,select,insert,update,delete
audit_whitelist_users=blacklist,mysql2,gmetric,procdb
#登录mysql
INSTALL PLUGIN AUDIT SONAME 'libaudit_plugin.so';
SET GLOBAL audit_json_file=ON;
SET GLOBAL audit_whitelist_users='qrr,mysql2,gmetric,procdb,{}'
{}:表示空用户
#####查看audit插件: SHOW GLOBAL VARIABLES LIKE '%audit%';
#####查看Mysql插件目录: SHOW GLOBAL VARIABLES LIKE 'plugin_dir';