Posts Tagged ‘ mysql

Restoring a gziped MySQL DB backup file

Short post… just for reference:

gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]

MySQL database restoration error

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.