Posts

How to Enable mysql slow query logs in Debian/Ubuntu

Step 1: Modify /etc/mysql/my.cnf File

To enable mysql slow query logs add the lines in my.cnf file.

#vi /etc/mysql/my.cnf

log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

Step 2: Restart mysql service

After inserting the above entries restart mysql server.

#service mysqld restart