GCP MySQL server has gone away (Google SQL MySQL 2

2019-08-05 07:23发布

问题:

We are running on Google Compute Engine/Debian9/PHP/Lumen/Doctrine2 <-> Google SQL MySQL 2nd Gen 5.7.

Usually it works without hiccups, but we are now getting error messages, similar to the one below, with increasing frequency:

Error while sending QUERY packet. PID=123456

PDOStatement::execute(): MySQL server has gone away

Any idea why this is happening and how i would fix it?

回答1:

As noted here, there is a list of cases which may be causing this error. A few are:

  • You have encountered a timeout on the server side and the automatic reconnection in the client is disabled (the reconnect flag in the MYSQL structure is equal to 0).
  • You can also get these errors if you send a query to the server that is incorrect or too large...An INSERT or REPLACE statement that inserts a great many rows can also cause these sorts of errors.

. . .

Please refer to the link for a complete list.

Also, there see this answers on the same problem.