Logging MySQL Queries

I often set up mysql query logging when I am diagnosing a problem.

In the my.cnf file, enter (or update the log parameter)


Remember to restart the mysql service:

sudo service mysql restart (ubuntu)
sudo service mysqld restart (centos)

And, ensure that the log file has the correct permissions for mysql to write to it.

After that you can tail the file to see what’s going on:

tail -f /path/to/logfile.log