1. Download plugins
HTTPS://mariadb.com/kb/en/mariadb-audit-plugin/
Compare the new MARIADB version audit plugin directly embedded in the version, can be installed directly
' server_audit.so;
2. Log in to the MySQL server to perform
like ' Plugin_dir ';
3. Add the CP to the Plugindir directory and install it (installs PLUGIN server_audit SONAME ' server_audit.so;)
Uninstall please use uninstall PLUGIN ' Server_audit ';
If you want to permanently load, just specify the following line in the configuration file, when uninstalling the plugin will be error, the plugin will not be uninstalled until the configuration file changes
[mysqld] plugin - Load =Server_audit=server_audit.soserver_audit=force_plus_permanent
View status
like ' server_audit% '\g
Command line enable audit, fail after reboot
(jlive)[Isfdb]>SETGLOBAL server_audit_logging= on; Query OK,0Rows Affected (0.15sec) (jlive)[Isfdb]>SETGLOBAL Server_audit_file_rotate_now= on; Query OK,0Rows Affected (0.00sec) (jlive)[Isfdb]>SHOW GLOBAL STATUS like 'server_audit%';+----------------------------+------------------+|Variable_name|Value|+----------------------------+------------------+|Server_audit_active| on ||Server_audit_current_log|Server_audit.Log ||Server_audit_last_error| ||Server_audit_writes_failed| 0 |+----------------------------+------------------+
4.VI/ETC/MY.CNF//Parameter curing settings
#auditserver_audit_events='connect,query,table' //server_audit_logging= onServer_audit_file_path=/Opt/Logs/Mysql/Auditlogs/server_audit_file_rotate_size=200000000server_audit_file_rotations= $
Parameter description:
Server_audit_output_type: Specifies the log output type, which can be a syslog or file
Server_audit_logging: Start or close an audit
Server_audit_events: Specifies the type of event to log, multiple values (connect,query,table) that can be separated by commas, and if query cache is turned on, the query returns data directly from the query cache without table records
Server_audit_file_path: If Server_audit_output_type is a file, use this variable to set the files that store the log, you can specify the directory, which is stored in the Server_audit.log file of the data directory by default.
Server_audit_file_rotate_size: Limit the size of log files
Server_audit_file_rotations: Specifies the number of log files that will never be rotated if the journal is 0 days
Server_audit_file_rotate_now: Force log file rotation
Server_audit_incl_users: Specifies which user's activity will be logged, and connect will not be affected by this variable, which is higher than the server_audit_excl_users priority
Server_audit_syslog_facility: Default is Log_user, specify facility
Server_audit_syslog_ident: Set ident as part of each syslog record
Server_audit_syslog_info: The specified info string is added to the syslog record
Server_audit_syslog_priority: Define SYSLOGD priority for logging
Server_audit_excl_users: User behavior for this list will not be logged and connect will not be affected by this setting
Server_audit_mode: Identity version for development testing
5. Restart MySQL
Service MySQL Restart
Reference:
Http://blog.sina.com.cn/s/blog_8ea8e9d50102wthg.html
Http://blog.chinaunix.net/uid-27088901-id-4820181.html
http://blog.csdn.net/heizistudio/article/details/47610217
Http://blog.sina.com.cn/s/blog_8ea8e9d50102wthg.html
https://mariadb.com/kb/en/mariadb/about-the-mariadb-audit-plugin/
MARIDB Installing the Audit Audit plugin