Category Archives: mysql

Debugging MySQL queries

Here’s how to temporarily enable logging of all statements sent to MySQL:

set global general_log_file='/tmp/queries.log';
set global general_log=1;

This will log all queries to /tmp/queries.log. To disable logging do:

set global general_log=0;

NOTE: This only works in MySQL 5.1+.