I've had to do this so many times that I'm putting on my blog as a reminder of how useful it is.
MySQL dumps are not compressed. The result is a flat text file which has a lot of room for compression. Using gzip can save a lot of space when downloading MySQL dump files. The dump can be compressed while it is being downloaded like this:
mysqldump -u {user} -p {database} | gzip > outputfile.sql.gz
Likewise, it can be uncompressed while importing it back into MySQL:
gunzip < outputfile.sql.gz | mysql -u {user} -p {database}
No comments:
Post a Comment