Tuesday, August 19, 2014

MariaDB Audit Plugin for MySQL

                                                      MariaDB Audit Plugin for MySQL
MariaDB Audit Plugin for MySQL:- The library is included in a tarball (server_audit-VERSION.tar.gz ) as 32-bit and 64-bit version for Linux for both, debug and non-debug versions of MariaDB and MySQL. I am using server_audit-1.1.7.tar.gz here.

Step1: Download MariaDB Audit Plugin for MySQL & untar the compressed tarball.
After untar we will get package of 32-bit and 64-bit version for Linux for both, debug and non-debug versions of MySQL.

Step2: Copy file that's meet the requirement and place at MySQL plugin dir mentioned in MySQL variable:-SHOW GLOBAL VARIABLES LIKE 'plugin_dir';
Note:Make sure for assign required ownership & privileges

Step 3: load plugin in MySQL:-
#~a~#The plugin can be loaded from the command-line as a start-up parameter, or it can be set in the configuration file (i.e.,
my.cnf or my.ini). Below is an excerpt from a configuration file, showing the relavent line to load this plugin. To use
this option from the command-line at start-up, just add a double-dash (e.g., pluginload).

[mysqld]
...
pluginload=server_audit=server_audit.so
...

#~b~#Another way to install this plug-in is to execute the INSTALL PLUGIN statement from within MySQL. You would need to
use an administrative account which has INSERT privilege for the mysql.plugin table. To do this, you would execute the
following within the mysql client or an equivalent client:
INSTALL PLUGIN server_audit SONAME 'server_audit.so';

Note:
--The variables that will be used by the plugin (see the Configuration section) will be unknown to the
server until the plugin has been loaded the first time. The database server will not start successfully if
these variables are set in the configuration file before the audit plugin has been loaded at least once
before.

--The UNINSTALL PLUGIN statement may be used to uninstall a plugin. For the auditing plugin, you might want to disable
this possibility. To do this, you could add the following line to the configuration file after the plugin is loaded once:
[mysqld]
...
pluginload=server_audit=server_audit.so
server_audit=FORCE_PLUS_PERMANENT
...

--Once you've added the option above to the server's configuration file and restarted the server, if someone tries then to
uninstall the audit plugin, an error message will be returned. Below is an example of this with the error message:
UNINSTALL PLUGIN server_audit;
ERROR 1702 (HY000):Plugin 'server_audit' is force_plus_permanent and can not be unloaded

No comments:

Post a Comment