SwapSQL

Migration errors

Fix: MySQL server has gone away during import

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

When it happens

Importing a large dump with big INSERT statements or BLOBs.

Why it happens

A single statement in the dump is larger than the server's max_allowed_packet (default is often 64 MB, sometimes less).

How to fix it

1. Raise the limit for the import

mysql --max_allowed_packet=512M mydb < dump.sql

and on the server: SET GLOBAL max_allowed_packet=536870912;

2. Check for other causes

wait_timeout too low, or the server OOM-killed — check the MySQL error log if raising the packet size doesn't help.

3. Dumps from our converter

keep INSERT batches small (≈2 MB) precisely so they fit default server limits.

Migrating between MySQL and PostgreSQL?

Our converter handles this and dozens of other gotchas automatically — upload a dump, download working SQL.

Try the converter free

More: all migration guides & error fixes