I’ve recently switched from PostgreSQL and MSSQL to MySQL. I ran into a bit of an issue today where I needed to see the queries I was generating for an insert statement. For MSSQL I’d normally use SQL profiler.
After a bit of Googling I came across the following solution for MySQL:
-- Enable the logging SET GLOBAL log_output = 'TABLE'; SET GLOBAL general_log = 'ON'; -- View the results SELECT * FROM mysql.general_log
Running this in Sequel Pro displays an output similar to the following:
Thanks to the following StackOverflow post for the info: https://stackoverflow.com/a/678310/522859