Category Image Monitoring MySQL Performance Using Log Files


MySQL has a number of different log files. Learn more here . This article details how I set them up on my servers.

As a general rule and to avoid needless troubleshooting make sure to create an initial empty log file and set the owner/permissions on all mysql log files as follows:

Creating a log file for example:
% sudo touch filename.log

Setting owner/group
% sudo chown mysql:wheel filename.log

Setting permissions to -rw-r-----
% sudo chmod 644 filename.log

Slow Query Log

To log queries taking longer than 2 seconds to a log file in /var/log directory add these to the my.cnf file:

[mysqld]
log_slow_queries=/var/log/mysql_slow_query.log
long_query_time=2

Posted: Wednesday - May 11, 2005 at 04:15 PM        


Published by