I've inherited some 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.
我继承了一些使用原始“mysql_query”的代码。没有包装或任何东西。我想得到发送给MySQL的每个查询的日志,并且服务器人已经回家了,所以我不能要求他暂时打开查询登录。
Is there any way of doing this?
有没有办法做到这一点?
Cheers.
3 个解决方案
#1
0
- 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)
在某处安装mysql_proxy,
使用LUA脚本配置它以记录所有语句。
将代理连接到真实服务器
将您的应用程序连接到代理(数据库连接设置)
#2
1
run:
mysql_query('SET GLOBAL general_log = 1;');
#3
1
You might be able to do it with SET GLOBAL general_log = 'ON';
你可以用SET GLOBAL general_log ='ON'来做到这一点;
#1
0
- 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)
在某处安装mysql_proxy,
使用LUA脚本配置它以记录所有语句。
将代理连接到真实服务器
将您的应用程序连接到代理(数据库连接设置)
#2
1
run:
mysql_query('SET GLOBAL general_log = 1;');
#3
1
You might be able to do it with SET GLOBAL general_log = 'ON';
你可以用SET GLOBAL general_log ='ON'来做到这一点;