简体   繁体   English

神秘幽灵MySQL插入查询

[英]Mystery ghost MySQL insert query

My MySQL db has inserted rows which should not be there, in a particular there is data in a column not generally used. 我的MySQL数据库插入了不应该存在的行,特别是列中的数据不常用。 I thought this would make it easy to find which PHP script was inserting the rows but i have searchd all insert querys for the entire site and cannot find which php script is running the insert query. 我以为这样可以很容易地找到哪个PHP脚本正在插入行,但是我已经搜索了整个网站的所有插入查询,而找不到哪个php脚本正在运行插入查询。

Its also very hard to replicate as this particular table has many crons updating it. 它也很难复制,因为此特定表有许多表更新程序。

Can anyone please try point me in the right direction of how I might go about debugging this. 任何人都可以尝试为我指出正确的调试方向。 Is there a stack track I can use to determine the originating php script. 有没有可以用来确定原始php脚本的堆栈跟踪。 Because it hard to replicate and I've spend two days searching for the code causing the inserts Im open to suggestions. 因为难以复制,并且我花了两天时间搜索导致插入的代码,所以我对建议不屑一顾。

Im normally quite good at debugging but this bug is like a ghost. 我通常很擅长调试,但是这个错误就像个鬼。

The only thing I can think of, if you have looked at all your code including in all your old cron scripts, is to put an insert trigger on that table, and use it to find out what time of day your extra rows get inserted. 如果您查看了所有代码(包括所有旧的cron脚本中的代码),我唯一想到的就是在该表上放置一个插入触发器,并使用它来查找一天中什么时候插入了额外的行。

Nasty problem! 讨厌的问题!

This might be a horrible idea depending on your error reporting settings and what type of environment you are debugging in, but if you are in a position to have some errors thrown I'd remove write permissions for the column in question and wait to see what script throws the error. 根据您的错误报告设置和要在哪种环境中进行调试,这可能是一个可怕的主意,但是如果您有可能抛出一些错误,那么我将删除有关列的写权限,然后等待看一下脚本引发错误。 If you are lucky log/report for the error will be written to include a script name and line. 如果您很幸运,则会记录错误的日志/报告,其中将包含脚本名称和行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM