Mysql provides the general query log.
In the General query log, mysql records information about connection/disconnection by users and information about each statement received from clients. You can use this log file for debugging purpose. By default, the general query log is disabled. To enable the general query log on debian running mysql Ver 14.14 Distrib 5.5.44, for debian-linux-gnu (x86_64) using readline 6.2 go ahead these steps:

Step 1 – with your favourite editor open the /etc/mysql/my.cnf configuration file. (I use vim)
$ sudo vim /etc/mysql/my.cnf

Step 2 – uncomment the lines
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1

Step 3 – save the file
inside vim, type :wq

Step 4 – restart mysql
$ sudo /etc/init.d/mysql restart

Step 5 – Prepare the log file to be written
$ sudo touch /var/log/mysql/mysql.log
$ sudo chown mysql:mysql mysql.log

That’s all

11788381-php-mysql-development

to view the log file
$ tail -f /var/log/mysql/mysql.log

Try to run some queries on the db, you should see something like the following output:

150806 9:56:58 50 Connect root@localhost on my_db
50 Prepare SELECT * FROM table WHERE title = ?
50 Close stmt
50 Prepare SELECT tab.id
FROM table tab
INNER JOIN messages ON messages.id = tab.m_id
WHERE messages.id = ? AND tab.isSender = 1
50 Close stmt
50 Quit

Since this log file becomes bigger and bigger fast, use it with caution. To disable the general log file, simply comments the two lines uncommented in the Step 2 and then restart mysql as shown in Step 4.

Gg1