Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 122010

Enable slow query log in MySQL


Turn on the Slow Query log in MySQL allow you to debug the sources of slow and problematic SQL.

To activate it, edit the MySQL configurations, e.g. /etc/my.cnf

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

Restart MySQL and you will notice the file mysqld-slow.log will be created.

Any queries take more than 5 seconds to execute will be logged in this file.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>