Ubuntu: enable MySQL logging

In /etc/mysql/my.cnf, under Logging and Replication, uncomment log

# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
log             = /var/log/mysql/mysql.log

Restart MySQL

sudo /etc/init.d/mysql restart

View queries

tail -f /var/log/mysql/mysql.log

Turn it off when you're done because:

  • impact on performance
  • file size can grow quickly

Reference

 

Feedback