MySQL Has Gone Away

Don’t you love error messages like that? I got this error message today while trying to do a dump from one database to another that happened to have a lot of data in it:

ERROR 2006 (HY000) at line 44: MySQL server has gone away

Isn’t that special? Well, it turns out that my server wasn’t configured with a large enough memory setting for the variable max_allowed_packet in the [mysqld] section of the my.ini that is used to configure my MySQL server. I had set the max allowed packet size on the command line to be “4M” which is more than 1M which was set on the server so the connection would crap out during the transfer. In MySQL a packet is a single SQL statement sent to the client. The table in question has some large LOBs in it so that’s why I ran into the problem. In most cases the default value would work but of course, this isn’t most cases (see: link)

By resetting the max_allowed_packet variable to be 4M and restarting the server I was able to finish the transfer.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s