Import a compressed database dump


If you compress your dumps, you'll also have to uncompress them before you can import them, but maybe you can do all of this in one step?


Thanks to pipes you can always redirect the output of a programm to the input of another one. Most *nix console applications support this.

Assuming you've compressed your dump with bz2, you can use the command below to import it back into your database:

bunzip2 < dump.sql.bz2 | mysql <mysql options>

The same works for gunzip, simply replace bunzip2 and you're good to go.


Please sign-in to post a comment