Saturday, September 15, 2012

MySQL: Check logs of queries

Apply for MySQL >= 5.1.12:
1. Open MySQL console
2. Execute SET GLOBAL log_output = 'TABLE';
3. Execute SET GLOBAL general_log = 'ON';
4. Check table mysql.general_log (should ORDER BY event_time DESC)

To turn off:
5. Execute SET GLOBAL general_log = 'OFF';

If you want to put logs to file:
SET GLOBAL log_output = "FILE";
SET GLOBAL general_log_file = "your_folder/your_file.log"
Subscribe to RSS Feed Follow me on Twitter!