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 / 5. Vote count: