How to find the latest queries run in MySQL

Run the following queries –

  1. SET GLOBAL log_output = 'TABLE';
  2. SET GLOBAL general_log = 'ON';

After the latest 100 queries executed after this is done can be found by running the query –

SELECT * FROM mysql.general_log where argument like ‘%[queryPiece]%’ order by event_time desc LIMIT 0,100

Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

Your email address will not be published. Required fields are marked *