0

MySQL version 5.7.26 MySQL Community Server (GPL)

OS : CentOS 7.6

I was trying to install audit plugin for MySQL database. But, I encountered the following error

mysql> INSTALL PLUGIN audit_log SONAME 'audit_log.so';
ERROR 1142 (42000): INSERT command denied to user 'root2'@'10.80.16.236' for table 'plugin'
mysql>

I would like to know if there is an Audit plugin available for Community edition. If so, how can I install it?

I don't see the audit plugin in the plugin directory

# pwd
/usr/lib64/mysql/plugin
# ls -l
total 59556
-rwxr-xr-x. 1 root root   103728 Apr 13 14:36 adt_null.so
-rwxr-xr-x. 1 root root   356976 Apr 13 14:36 authentication_ldap_sasl_client.so
-rwxr-xr-x. 1 root root    43552 Apr 13 14:36 auth_socket.so
-rwxr-xr-x. 1 root root   940312 Apr 13 14:36 connection_control.so
drwxr-xr-x. 2 root root     4096 May  3 04:03 debug
-rwxr-xr-x. 1 root root 21640312 Apr 13 14:36 group_replication.so
-rwxr-xr-x. 1 root root   483520 Apr 13 14:36 ha_example.so
-rwxr-xr-x. 1 root root   968432 Apr 13 14:36 innodb_engine.so
-rwxr-xr-x. 1 root root   957088 Apr 13 14:36 keyring_file.so
-rwxr-xr-x. 1 root root   460064 Apr 13 14:36 keyring_udf.so
-rwxr-xr-x. 1 root root  1184680 Apr 13 14:36 libmemcached.so
-rwxr-xr-x. 1 root root  8973984 Apr 13 14:36 libpluginmecab.so
-rwxr-xr-x. 1 root root    21424 Apr 13 14:36 locking_service.so
-rwxr-xr-x. 1 root root    53928 Apr 13 14:36 mypluglib.so
-rwxr-xr-x. 1 root root    41088 Apr 13 14:36 mysql_no_login.so
-rwxr-xr-x. 1 root root 22243648 Apr 13 14:37 mysqlx.so
-rwxr-xr-x. 1 root root    49504 Apr 13 14:36 rewrite_example.so
-rwxr-xr-x. 1 root root   590936 Apr 13 14:36 rewriter.so
-rwxr-xr-x. 1 root root   933904 Apr 13 14:36 semisync_master.so
-rwxr-xr-x. 1 root root   159928 Apr 13 14:36 semisync_slave.so
-rwxr-xr-x. 1 root root   209520 Apr 13 14:36 validate_password.so
-rwxr-xr-x. 1 root root   506320 Apr 13 14:36 version_token.so
#

1 Answer 1

1

Based on your error, you just need to grant the insert privilege to the 'root2' user:

GRANT INSERT ON *.* TO 'root2'@'10.80.16.236'

(you'll need to modify this based on your actual 'root2' user)

In terms of whether there is a plugin available, technically the mysql audit log plugin is only for the enterprise edition, and not the community edition.

That said you can usually use the one supplied by Percona or Mariadb with MySQL (there may be others).

I use the Percona one with my 5.5 databases, and the Mariadb one with my 5.7 databases, as I couldn't get the Percona version to work with 5.7.

You install them in exactly the same way. Download them, and place the file in your plugins directory first,then

Percona INSTALL PLUGIN audit_log SONAME 'audit_log.so';

Mariadb INSTALL PLUGIN audit_log SONAME 'server_audit.so;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.