In PHP web development what relate to database, I usually want to check my SQL detail. But not all of time, I can debug line by line or print out the SQL query to check. Instead of showing SQL queries, I will make it show everything in mysql log file with detail of SQL to check. Here is the easiest way to monitor SQL queries in Linux (you can do the same in Windows or Mac).
Visit the mysql configuration file:
Find and uncomment this line
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
log = /var/log/mysql/mysql.log
Now restart mysql server
sudo /etc/init.d/mysql restart
Now we’re ready to start monitoring the queries as they come in. Open up a new terminal and run this command to scroll the log file, adjusting the path if necessary.
tail -f /var/log/mysql/mysql.log