Compress MysqlDump Output

Ağustos 18
      Making backup

all databases


mysqldump -u root -p --all-databases > dump.sql

      Making backup only

one database


mysqldump -u root -p --databases db1 > dump.sql

      Making backup

many databases


mysqldump -u root -p --databases db1 db2 db... > dump.sql

      Making backup with



mysqldump -u root -p --triggers --all-databases > dump.sql

    Making backup with

procedures and functions:

mysqldump -u root -p --routines --all-databases > dump.sql

    Now let’s compress our dump in real time with


mysqldump -u root -p --all-databases | gzip > dump.sql.gz

    We can still reach a higher compression ratio using the


mysqldump -u root -p --all-databases | bzip2 > dump.sql.bz2

Making a comparison between the dump with three compression options (none, gzip and bzip2) had the following result:

    Dump normal – 947k
    Dump com gzip – 297k
    Dump com bzip2 – 205k

And how do I restore the dump?


mysql -u root -p < dump.sql


gunzip < dump.sql.gz | mysql -u root -p


bunzip2 < dump.sql.bz2 | mysql -u root -p

Arama Terimleri:


Posted by on 18 Ağustos 2014 in Bilgisayar, SQL

Leave a comment

Bir Cevap Yazın