Start by logging into MySQL as root:
mysql -u root
Enter the following SQL statements:
SET GLOBAL query_cache_type=OFF;
SET global log_output = 'FILE';
SET global general_log_file='/tmp/query.log';
SET global general_log = 1;
Now load a page or run a command. All of its raw queries will be logged into /tmp/query.log
.
You can remove the above settings by restarting MySQL:
sudo service mysql restart