mysql server has gone away - how do I debug the reason?
I'm experiencing "mysql server has gone away" in my import script written in php
This http://dev.mysql.com/doc/refman/5.0/en/gone-away.html page has a list of possible reasons. But, how do I debug this, to know which of the reasons?
If some time out fired, I want to know which that his happened, which timeout etc. relevant details. If the query was broken, I want to know that this is the reason.
So, do I have a way to receive the details additionally t开发者_如何学Pythono just the very global piece of information that the server "has gone away"?
Is there a way to log this stuff: timeouts for example?
I wouldn't think that there's a MySQL magic bullet to find out. It sounds like you need to use operating system and/or network diagnostic tools. Maybe within PHP you can do some things like try pinging the server, checking if the MySQL daemon is running, etc. You might also want to check into using a tool such as Wireshark or tcpdump to see if you're seeing anything funky on the network, such as reset packets or other dropped connection indicators.
If the MySQL server is remote, try doing a constant ping to it and see if you're seeing dropped or delayed packets. Make sure you check with large packets; I've seen systems on which a ping works fine, but routers screw up larger packet sizes due to MTU mismatches and such. On Windows, it is:
ping -t -l 1500 mysqlhost
On most Linux and Unix systems, it is:
ping -s 1500 mysqlhost
精彩评论