That worked for me on Ubuntu.
Find and open your MySQL configuration file, usually /etc/mysql/my.cnf
on Ubuntu. Look for the section that says “Logging and Replication”
# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
log = /var/log/mysql/mysql.log
or in newer versions of mysql, comment OUT this lines of codes
general_log_file = /var/log/mysql/mysql.log
general_log = 1
log_error = /var/log/mysql/error.log
Just uncomment the log
variable to turn on logging. Restart MySQL with this command:
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