列出对数据库的所有查询

is there a way to list all queries that are executed by PHP script? How I see it - when PHP script send a query to DB, for example: SELECT * FROM table, I would like to save the query string, name of the file that send that query and time. Is it possible when I don't have access to PHP script? What if I do have? Maybe there are that kind of logs in php my admin? Thanks in advice.

There are two ways to do that:

  1. Use the Logs, Enable the Mysql Logs thus every query is recorded in the log but the limitation is you have to again query the logs to view specific things.

  2. Second, way is to create trigger so that every activity is recorded in table. for example:

    Create ON INSERT, ON_UPDATE and ON_DELETE triggers

for your table that write details of all changes to an audit activity table