Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using WAMP server for my web application . Sometimes I see this General error: 2006 MySQL server has gone away'

I am updating the MySQL database through PDO PHP.

Any suggestions to avoid this ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
475 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try to debug the problem. This can be caused by any number of things. Commonly there are:

  • The MySQL server crashed
  • A comms problem between the client and server
  • Abusing the client library in a way not intended, perhaps sending commands out of order or sending junk through the socket.

Last time I used it the PDO driver was quite flakey and it was possible to create the last case.

If the comms problem is likely in production, your application should reconnect and retry the transaction.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...