Slow Query Log in MySQL 5.1 Cheat Sheet

I try to eliminate warnings and errors in the error log as much as possible – not just fixing actual issues, but also to eliminate the noise in the error log.  As I have been doing 5.1 upgrades lately, I have been seeing a lot of the following errors in the error log when upgrading:

[Warning] ‘–log_slow_queries’ is deprecated and will be removed in a future release. Please use ”–slow_query_log’/’–slow_query_log_file” instead.

And every time that happens I have to remember the proper syntax for slow query logging.  Finally I just wrote it in my ongoing cheat sheet, it’s just a short text document that I keep on my desktop, and items rotate in and out of it frequently.

Without further ado, here is my cheat sheet for upgrading your slow query log from MySQL 5.0 to  MySQL 5.1:

 

change 

log-slow-queries=/var/log/mysqld/log-slow-queries.log 

to 

log_output=FILE # also can be FILE,TABLE or TABLE or NONE 

slow-query-log=1 

slow_query_log_file=/var/log/mysqld/log-slow-queries.log 

Note that setting log_output will also set the general_log output.  It does not change anything about error logging.

 

I try to eliminate warnings and errors in the error log as much as possible – not just fixing actual issues, but also to eliminate the noise in the error log.  As I have been doing 5.1 upgrades lately, I have been seeing a lot of the following errors in the error log when upgrading:

[Warning] ‘–log_slow_queries’ is deprecated and will be removed in a future release. Please use ”–slow_query_log’/’–slow_query_log_file” instead.

And every time that happens I have to remember the proper syntax for slow query logging.  Finally I just wrote it in my ongoing cheat sheet, it’s just a short text document that I keep on my desktop, and items rotate in and out of it frequently.

Without further ado, here is my cheat sheet for upgrading your slow query log from MySQL 5.0 to  MySQL 5.1:

 

change 

log-slow-queries=/var/log/mysqld/log-slow-queries.log 

to 

log_output=FILE # also can be FILE,TABLE or TABLE or NONE 

slow-query-log=1 

slow_query_log_file=/var/log/mysqld/log-slow-queries.log 

Note that setting log_output will also set the general_log output.  It does not change anything about error logging.