Connection to the server was lost

from the Artful MySQL Tips List

This response to a query has four possible causes ...

1 the server crashed

2 net_read_timeout is shorter than the time the query took. If that's so, increasing it—or better, optimising the query—will fix the problem

3 connect_timeout is shorter than the time taken to connect. If that's so, show global status like 'Aborted_connects' will increment by 1 on each connection attempt, and increasing connect_timeout will fix the problem

4 max_packet_size is smaller than blobs asked for by the query. If so, you should see a packet-too-large error, and increasing packet size should fix the problem—unless you are trying to send packets larger than the MySQL hard limit of 1GB, in which case you'll need to chunk those longblobs.

Last updated 10 Dec 2019

Return to the Artful MySQL Tips page