I'm regularly facing the following situation; I am working on an existing system built in PHP which does something, actually quite a lot and it's generally consisting of lots of code. Now I have to extend some feature, debug something and need to know how the system interacts with the MySQL-DB. Which requests are executed in what order.
How can I intercept all queries? Something like xdebug_start_trace for The database.
EDIT: There is no centralized handling of DB-requests. You find every kind of request there. So my question is directed towards some logging feature. Basically that should exist, as it is common sense that somthing like that might be useful.
EDIT2: Mario suggested solution which depends on restarting the mysql-deamon ... no can do. More suggestions?
解决方案
You can use MySQLs "general query log" by starting mysqld with a --log=fn parameter first.
http://dev.mysql.com/doc/refman/5.1/en/query-log.html