You have some sticky queries but you can’t see what’s happening. On certain website actions pages are just slow and you fully suspect the database queries are broken. Or you want to reverse engineer another piece of software’s database queries.
How you can turn on MySQL query logging. Go into the MySQL console and do:
SET GLOBAL general_log = 'ON'; SET GLOBAL general_log_file = '/tmp/mysql.log';
Keep the console open, because when you’re done you want to set the “ON” above back to “OFF”.
Open another terminal and do:
tail -f /tmp/mysql.log