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 useful in troubleshooting bad queries.
To edit a file, first make a back-up.
cp /etc/my.cnf /etc/my.cnf.old
Then Now open it in vi:
vi /etc/my.cnf
Add the following line to enable the slow query log:
log-slow-queries=/var/lib/mysql/slow.log
After that, do the following commands to create the file with the right ownership and file permissions:
vi /var/lib/mysql/slow.log chmod 660 /var/lib/mysql/slow.log chown mysql:mysql /var/lib/mysql/slow.log
Once you are done, restart mysql.