Compressing MySQL database dump


Dump files can be rather big, that probably causes the need for compression. Here's how that works!


You can always dump the database and then compress it, but that will consume quite a bit more table space.

Instead you can use pipes to redirect the output to bzip2 and directly write to a comperss file.

mysqldump <mysqldump options> | bzip2 > dump.sql.bz2

You need to have bzip2 installed on your system to get this working. There are many options to compress data, gzip would be an alternative which is faster, but less efficient regarding the size of the compressed dump file.


Please sign-in to post a comment