How to: Logging MySQL Login Attempts

This guide shows how to enable logging on MySQL which includes SELECT commands and login attempts. This can cause performance issues so only use when really important.

1. Open the my.cnf file

2. Add the following files:-

general_log_file = /var/log/mysql/general.log
general_log = 1

3. Restart Mysql Server using ‘service mysqld restart’

You will now find the logs in /var/log/mysql/general.log

Remember that this log may show SELECT commands that include passwords and sensative details, so ensure you secure them and dont keep them longer than necessary.