Losing data on MySQL SQL restore
Sep.19, 2008 in
Databases
I recently had to backup and restore a MySQL database so I dumped the whole database into a SQL file but when I came to restore I found that in one of the biggest tables a lot of the data was missing.
Looking at the warnings when I ran the restore query I found I had:
Error Code: 2006 – MySQL server has gone away
I looked up this error and it seems the MySQL server’s max_allowed_packet setting was too low compared to the size of bulk inserts that the restore file was trying to do.
I increased the max_allowed_packet setting to 16M and ran it again and all was well!
See http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html for details.
Leave a Reply
You must be logged in to post a comment.