Activating and inspecting MySQL or MariaDB logs

Published on 2024-07-20 • Modified on 2024-07-20

This snippet shows how to activate and inspect MySQL or MariaDB logs. For example, This is useful for checking the queries run by some legacy code. It is far more efficient than retrieving the actual SQL from the code. Of course, we can filter the rows by event_time to get what is needed.


SET GLOBAL general_log=1;
SET GLOBAL log_output='TABLE';
SELECT event_time, argument FROM mysql.general_log

 More on Stackoverflow   Read the doc  More on the web  Random snippet

  Work with me!


Call to action

Did you like this post? You can help me back in several ways: (use the "reply" link on the right to comment or to contact me )

Thank you for reading! And see you soon on Strangebuzz! 😉

COil