More Technical Help

Monday, January 17, 2011

Enable Logging of Slow MySQL Queries

MySQL has a feature that allows you to log slow running queries to a file. To enable you just need to add some lines to your my.cnf file, and restart.
Insert the following into /etc/my.cnf:
Save my.cnf and do the following when you return to a shell:
log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 5


#touch /var/log/mysql/mysql-slow.log
#chown mysql:mysql /var/log/mysql/mysql-slow.log
#service mysql restart

0 comments:

Post a Comment