MySQL database restoration error

less than 1 minute read

So I was trying to restore a backup database from a .sql file through the following command:

mysql database < file.sql

And an error resulted:

Got a packet bigger than 'max_allowed_packet' bytes

This is most likely due to the fact that there are large images and other files in the database causing problems. I had to edit the MySQL configuration files and added the following:

vim /etc/my.cnf

set-variable=max_allowed_packet=xM

For my particular issue, I had to change x to 512. This may vary depending on how large your files are.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...