How to enable ‘General Query Log’ in Mysql?

General Query Log is used to keep track of mysql status i.e. it writes the information when a client connects/disconnects OR a query is executed. It is useful when the number of people managing the database is high. In order to enable ‘General Query Log’,
edit the Mysql configuration file
vi /etc/my.cnf
enable the log under the ‘mysqld’ section
log=/var/log/mysql.general.log
Save the file. Now create the log file and set the mysql ownership
touch /var/log/mysql.general.log
chown mysql.mysql /var/log/mysql.general.log
Now, restart the mysql service
/etc/init.d/mysql restart
You can now execute the queries using phpMyAdmin OR 3rd party sql software and watch the logs
tail -f /var/log/mysql.general.log

No comments:

Post a Comment