How to enable MySQL slow query log
The slow query log consists of SQL statements that took more than long_query_time seconds to execute and required at leastmin_examined_row_limit rows to be examined. It is very helpful in troubleshooting bad queries.
Add the following to /etc/my.cnf file to enable the slow query log:
Code: [Select]
 
log-slow-queries=/var/lib/mysql/slow.log
 
After that, then do the following commands to create the file
 
with the right ownership and file permissions:
 
Code: [Select]
 
touch /var/lib/mysql/slow.log
 
Code: [Select]
 
chmod 660 /var/lib/mysql/slow.log
 
Code: [Select]
 
chown mysql:mysql /var/lib/mysql/slow.log
Done..!!