On mysql command line
SET global general_log_file='/var/log/mysql/my_query_log.log'; SET global general_log = on; SET global log_output = 'file';
When finished turn it off
SET global general_log = off;
1. Check and enable query logging
show variables like 'general_log%'; SET global general_log = 1;
2. wait some time
SET global general_log = 0; grep 'Query' /var/lib/mysql/my_query_log.log | sed -e 's/.* Query//' | sort | uniq -c | sort -rn | less