How to log each MySQL query

To log each and every query executed by MySQL, simply specify “-l” when starting mysqld_safe. For instance:

/usr/bin/mysqld_safe -l ...

All queries will then be logged to <hostname>.log in the data directory (typically /var/lib/mysql).

Leave a Reply