Execute a function each time mysql_query is called. (PHP)
I've inherited so开发者_Python百科me code which uses raw "mysql_query". No wrapper or anything. I want to get a log of every query sent to MySQL and the server guy has gone home, so I can't ask him to turn query logging on for a moment.
Is there any way of doing this?
Cheers.
run:
mysql_query('SET GLOBAL general_log = 1;');
You might be able to do it with SET GLOBAL general_log = 'ON';
- install mysql_proxy somewhere,
- configure it with a LUA script to log all statements.
- connect the proxy to the real server
- connect your application to the proxy (database connection settings)
精彩评论