Restoring a gziped MySQL DB backup file
Short post… just for reference:
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]
Posts Tagged ‘ mysql ’
Short post… just for reference:
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]
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.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Feb | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||