Logging mysql queries is turned off by default. But general logging of mysql service which includes errors and warning are turned on.
Sometimes though, you want to know what query your application is actually performing. This is useful while debugging applications that for instance use ORM(Object Relational Mapping) frameworks which basically map objects to relational tables so that you don’t have to write raw SQL syntax in your app. The ORM frameworks common with Ruby On Rails, Django and other frameworks translates your native language code into sql syntax. With Rails you can actually see the sql syntax in the production.log or development.log files under log directory.
But the alternative is to turn on logging from the database itself. You can do that in the following steps;
Open mysql configuration file my.cnf.
Search for general_log_file and general_log option and comment them out.
general_log_file = /var/log/mysql/mysql.log
general_log = 1
Step 3: restart mysql
service mysql restart
Step 4: Monitor mysql server log using tail
tail -f /var/log/mysql/mysql.log
Also put together a screencast for this. Totally a newbie to screencasting. I did this using the OBS studio after trying out numerous options. Hope to add more videos to future posts.