Show the last queries executed on MySQL

1) Execute SET GLOBAL log_output = 'TABLE';
2) Execute SET GLOBAL general_log = 'ON';
3) Take a look at the table mysql.general_log

If you prefer to output to a file:
1) SET GLOBAL log_output = "FILE"; which may be set by default, I think.
2) SET GLOBAL general_log_file = "/path/to/your/logfile.log"
3) SET GLOBAL general_log = 'ON';

I prefer this method because:
  1) you’re not editing the my.cnf file and potentially permanently turning on logging
  2) you’re not fishing around the filesystem looking for the query log – or even worse, distracted by the need for the perfect destination. /var/log /var/data/log /opt /home/mysql_savior/var
  3) restarting the server leaves you where you started (log is off)

For more information, see
MySQL 5.1 Reference Manual – Server System Variables – general_log

Leave a comment