How to , and other stuff about linux, photo, php … Another blog just like others on internet

February 28, 2012

MYSQL slow queries log

Filed under: Linux — Tags: , , — admin @ 5:18 pm

MySQL has built-in functionality that allows you to log SQL queries to a file , You can enable the full SQL queries logs to a file or only slow running queries log. It is easy for us to troubleshoot/ debug the sql statement if SQL queries log enable.
* To enable slow Query Log only
log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 1

The minimum and default values of long_query_time are 1 and 10, respectively.

* To enable full Log Query
This will log all queries on your mysqld.

Selecting Queries to Optmize
– The slow query log
– Logs all queries that take longer than long_query_time
– Can also log all querie s that don’t use indexes with
– To log slow administatve commands use
– To analyze the contents of the slow log use

Rate this post

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress