If you have the task of debugging a Function, Store Procedure or a Program, maybe you need to store all executed queries to run a certain debug. You can do this by configuring your MySQL to store all queries inside a mysql table.
1. Enable log.
execute "SET GLOBAL general_log = 'ON';"
execute "SET GLOBAL log_output = 'TABLE';"
2. Find inside your queries.
All queries now are stored in database/schema `mysql` inside table `general_log`, if you need to find a specific query, just run a query as below: