Subject: bug#25415: MySQL "server has gone away" when reloading database dump due to "max_allowed_packet" default

From: Ben Sturmfels <[email-masked]>
Date: Wed, 11 Jan 2017 11:10:03 +1100

Hi there!

I'm using GuixSD 0.12.0 and ran `guix package --install=mysql` (which
I gather gave me MariaDB 10.1.19), then created a database and tried to
reload a database dump of a decent sized existing database:

  zcat dump.sql.gz | mysql DBNAME

which failed with:

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

Reloading the same dump works for me on default MySQL in Trisquel 7.
The database dump was created on Debian with `mysqldump --no-create-db
DBNAME`.

On Guix, I was able to reload the dump by running mysqld with a custom
config file with max_allowed_packet=16M under [mysqld].

It appears that the default value for `max_allowed_packet` under
Debian/Trisquel is "16M", where under Guix it is "4M". The mysqldump
defaults bunche a whole lot of records into a single insert statement
for performance, which is why I'm getting a value > 4M.

Could it be worth setting max_allowed_packet to 16M in Guix's
`mysql-configuration-file` function for consistency with Debian?

Regards,
Ben