Search code examples
mysqlmysql-error-2006

MySQL error 2006: mysql server has gone away


I'm running a server at my office to process some files and report the results to a remote MySQL server.

The files processing takes some time and the process dies halfway through with the following error:

2006, MySQL server has gone away

I've heard about the MySQL setting, wait_timeout, but do I need to change that on the server at my office or the remote MySQL server?


Solution

  • It may be easier to check if the connection exists and re-establish it if needed.

    See PHP:mysqli_ping for info on that.