本文介绍了如何拦截数据库请求? (MySQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常遇到以下情况;我正在使用PHP构建的现有系统上工作,该系统实际上可以完成很多工作,并且通常由许多代码组成.现在,我必须扩展某些功能,调试一些功能,并且需要了解系统如何与MySQL-DB交互.哪些请求以什么顺序执行.

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.

如何拦截所有查询?类似xdebug_start_trace的数据库.

How can I intercept all queries? Something like xdebug_start_trace for The database.

没有集中处理数据库请求.您可以在那里找到各种要求.所以我的问题是针对某些日志记录功能的.基本上应该存在,因为按照常识,这样的事情可能有用.

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.

Mario建议的解决方案取决于重新启动mysql-deamon ...不能执行.还有建议吗?

Mario suggested solution which depends on restarting the mysql-deamon ... no can do. More suggestions?

推荐答案

您可以通过首先使用--log=fn参数启动mysqld来使用MySQL的一般查询日志". http://dev.mysql.com/doc/refman/5.1 /en/query-log.html

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

这篇关于如何拦截数据库请求? (MySQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 01:08