How can I log queries as they hit a MySQL server?
Connect to MySQL with a client.
- enter: set global general_log = 'ON';
- enter: set global log_output = 'TABLE';
- query the table mysql.general_log (e.g., select * from mysql.general_log)
- Log to file:
set global log_output='FILE';
- Turn logging off:
set global general_log='OFF';
set global log_output='NONE';
- Change the log file name (the mysql user must be able to write it), for example:
set global general_log_file='mysql.q.log';
Add a Comment
NOTE: Comments are moderated and will not show until approved.