Enable General MySQL Log without a restart

Here’s a quick and easy way to enable the MySQL General Log, to log all queries sent to the database. Great for debugging.
Open up a MySQL console and input the following. Change the log file location to suit.

[codesyntax lang=”mysql”]
SET global log_output = ‘FILE’;
SET global general_log_file=’/var/lib/mysql/all.log’;
SET global general_log = 1;

Don’t forget to disable it after use as it could impact performance.

[codesyntax lang=”mysql”]
SET global general_log = 0;

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *