MySQL : View Executed Queries on MySQL Server Log - DevDummy

Latest

Views | Thoughts | Concepts | Techniques

Friday, June 22, 2018

MySQL : View Executed Queries on MySQL Server Log


It is often required to investigate the queries executed on MySQL Server Log for many reasons when debugging.

Specially it allows to see the values passed in for the parameters for query execution. 

Set the Flags

SET GLOBAL log_output = 'TABLE';

SET GLOBAL general_log = 'ON';

Query the General Log

select event_time, CAST(argument AS CHAR(10000) CHARACTER SET utf8) from mysql.general_log order by event_time desc;

Above query will list the queries executed on the MySQL server with latest query first.

Note : Admin permission is required to execute the above query.

...

No comments:

Post a Comment