MySQL connection logs backtrack

MySQL

Is there a way to backtrack who connects to MySQL server? Aside from show processlist;? I want to see who connects last day. Thank you.

Best Answer

There are multiple audit logging products available. If you are using Percona or MariaDB flavour of MySQL you have the option of their plugin. If you are using Oracle MySQL you can pay for their enterprise version of audit plugin (as part of Enterprise Edition). There is also an audit plugin from McAfee that will fill this requirement and is generally available cross-alternative and from 5.1+. These products permit you to log both logins and queries. Finally there's a plugin to track logins only from a community contributor. Links to all below.

http://www.percona.com/doc/percona-server/5.5/management/audit_log_plugin.html https://mariadb.com/kb/en/mariadb/documentation/plugins/mariadb-audit-plugin/ http://dev.mysql.com/doc/refman/5.5/en/audit-log-plugin.html http://code.openark.org/blog/mysql/introducing-audit_login-simple-mysql-login-logfile-based-auditing