Problem with mysql when trying to migrate a site

When I move a site to a new VPS or server, I follow this procedure:

https://www.virtualmin.com/documentation/system/migrate

It usually works flawlessly. I just tried it and the migrate failed. Here is the output from the command line:

[root@www ~]# virtualmin restore-domain --source /root/backups.062617a/ --all-domains --all-features Checking for missing features .. .. WARNING - The following features were enabled for one or more domains in the backup, but do not exist on this system. Some functions of the restored domains may not work : DAV Login, Mailman

Checking for errors in backup .. .. no errors found

Starting restore.. Extracting backup archive files .. .. done

Restoring backup for virtual server immigrationlawofmt.com .. Restoring virtual server password, quota and other details .. .. done

Updating administration password and quotas ..
.. done

Restoring Cron jobs ..
.. done

Extracting TAR file of home directory ..
.. done

Setting ownership of home directory ..
.. done

Re-creating records in DNS domain ..
.. done

Restoring Apache virtual host configuration ..
.. done

Checking restored PHP execution mode ..
.. mode FCGId OK for this system

Updating home directory in PHP configuration ..
.. done

Restoring Apache log files ..
.. done

Restoring SSL Apache virtual host configuration and certificate ..
.. done

Restoring Logrotate configuration ..
.. done

Restoring allowed MySQL hosts ..
.. done

Deleting old MySQL databases ..
.. done

Re-loading MySQL database immiglawofmt ..
    Creating MySQL database immiglawofmt ..
    .. done

.. load failed! ERROR 2006 (HY000) at line 518: MySQL server has gone away

Re-starting DNS server .. .. done

Applying web server configuration .. .. done

Restore failed!

[root@www ~]#

This site does have a larger database, over around 20MB. Please advise on how to fix this error. Thanks.

Status: 
Active

Comments

Howdy -- try editing /etc/my.cnf, and see if there is an existing "max_allowed_packet" option.

If so, what is it set to? You may want to increase it a bit... perhaps to 64M.

If it's not there, try adding this to the "mysqld" section:

max_allowed_packet = 64M

And then restart MySQL.

After that, are you able to restore your backup?

Thanks for the help. max_allowed_packet was set for 1M. So I changed it to 64M and the recover worked fine. Do you recommend that I return to 1M? Or should I use some other number?

Great, glad to hear that helped!

I'd be tempted to leave the setting as is, but out of curiosity, how much RAM does your server have?

It is a KVM VPS 2GB of memory and 2GB of Virtual memory. Do you think it would be OK with that setting?

Yeah it should be no problem to leave that setting as is in your case.

Feel free to let us know if you have any additional questions!