Troubleshooting MySQL slow queries
mysql -u root -p
SHOW VARIABLES LIKE 'slow_query_log';
SHOW VARIABLES LIKE 'slow_query_log_file';
SHOW VARIABLES LIKE 'long_query_time';
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL slow_query_log_file = '/path/filename';
typically, the slow query log file is located at /var/lib/mysql/{hostname}-slow.log.
SELECT SLEEP(X);
test whether slow query log is working
SET GLOBAL slow_query_log = 'OFF';
turn off slow query log when you are done troubleshooting