*** Note the comments below, this is for MySQL 5.5. MySQL 5.6 uses slow_query_log ***
To enable the slow query log for your whm / cpanel server, do the following:
open /etc/my.cnf with your favorite editor and add the following lines under the [mysqld] section:
long_query_time = 3
The log_queries_not_using_indexes option will also write any queries to the file that are not using indexes. They may take less than your long_query_time threshold, but is good for finding easy targets for indexes and performance gains.
Then create the log file and set the proper permissions:
chmod 660 /var/lib/mysql/slow_queries.log
chown mysql:mysql /var/lib/mysql/slow_queries.log
Then restart mysql:
service mysql restart
If you want to view the contents of the file in real time, go to the mysql directory – /var/lib/mysql/ and then run:
tail -f slow_queries.log
Monitor the queries being written to the file and make adjustments as necessary.