Category: MySQL

How to enable MYSQL slow query log:

1. Edit /etc/my.cnf

2. Add the following:

#Slow Query Log
#Log file
log-slow-queries = /var/log/slow-queries-log          

#Logs queries longer than 2 sec 
long_query_time = 2                                           

#Logs queries not using indexes
log-queries-not-using-indexes TRUE

3. Change owner on log file /var/log/slow-queries-log to

chown mysql.mysql

4. Restart MYSQL

/etc/init.d/mysql restart

Tags:

mySQL

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.