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

Sreekumar Kj
Sreekumar (KJ) has been a hobby programmer from school days. Codemarvels is his personal blog from the year 2010, where he writes about technology, philosophy, society and a bit about physics. He now runs a conversational AI company - DheeYantra - focusing his efforts to help businesses improve operational efficiency using digital employees powered by AI.