MySQL server has gone away

During a restore, if you get an error similar to:

Unable to restore database user&#db.sql to user_db : ERROR 2006 (HY000) at line 403 in file: ‘/home/user/backups/backup/user_db.sql: MySQL server has gone away
it could mean either:

1) The server timed-out  and disconnected.

Adjust the wait_timeout value in the my.cnf.

2) MySQL could have been restarted mid-restore
3) or for many large databases

If the max_allowed_packet option, in the [mysqld] section of the /etc/my.cnf is too small, mysqld may abort if it hits a packet larger than that. If you’ve installed the my-huge.cnf, it has a default max_allowed_packet value of 1M. Try changing it to 5M or 10M, then restart mysqld and try again.