Pages

Tuesday, January 28, 2020

Logging command history in MySQL

Here are the important commands to keep around when logging what SQL statements you've thrown at MySQL when debugging, say, some Entity Framework issues...

-- SET GLOBAL log_output = 'TABLE';
-- SET GLOBAL general_log = 'ON';

SELECT * FROM  mysql.general_log  
WHERE command_type ='Query' 
and event_time > '2020-01-03 11:58:20'
ORDER BY event_time DESC
LIMIT 10

-- SET GLOBAL general_log = 'OFF';