How to enable query log in MySQL
1. MySQL has two logs , query log and error log. Both the log directive can be entered in the my.cnf. Error log is entered in the my.cnf in the format,
error_log = /var/log/mysqld.log , which contain information related to MySQL database errors and general MySQL errors.
Second is the query log whose directive can be entered in the MySQL configuration file in the format of ,
log = /var/log/mysql.log
Once query log is enabled create the file:
touch /var/log/mysql.log
chown mysql.mysql /var/log/mysql.log
This conatin the query infomation and is useful to know if some scripts to delete a table/db is executed. This can be verified by executing the below mysql query and verifying the log,
Login to MySQL console and execute the command,
=-=-
mysql > select 2+2;
=-=-
Now tailf of /var/log/mysql.log shows the query as,
=-=-
101216 20:20:20 10 Query SELECT 2+2
=-=-=
1. MySQL has two logs , query log and error log. Both the log directive can be entered in the my.cnf. Error log is entered in the my.cnf in the format,
error_log = /var/log/mysqld.log , which contain information related to MySQL database errors and general MySQL errors.
Second is the query log whose directive can be entered in the MySQL configuration file in the format of ,
log = /var/log/mysql.log
Once query log is enabled create the file:
touch /var/log/mysql.log
chown mysql.mysql /var/log/mysql.log
This conatin the query infomation and is useful to know if some scripts to delete a table/db is executed. This can be verified by executing the below mysql query and verifying the log,
Login to MySQL console and execute the command,
=-=-
mysql > select 2+2;
=-=-
Now tailf of /var/log/mysql.log shows the query as,
=-=-
101216 20:20:20 10 Query SELECT 2+2
=-=-=