gzipped mysql dump with drush

Public

You can dump site database with drush and gzip dump in same time. Based by http://dropbucket.org/node/177.

Get raw version
bash
  1. drush sql-dump | gzip -9 > <database>-$(date +%Y-%m-%d-%H.%M.%S).sql.gz

Comments

pfaocle's picture

Untested, but what about:

drush sql-dump --gzip --result-file=<database>-$(date +%Y-%m-%d-%H.%M.%S).sql

Not sure about the date substitution part, merely pointing out that gzip compression can be done with drush directly. Note the .gz is appended automatically.

Fidelix's picture

drush sql-dump --gzip --result-file

This will dump the file into your home directory, in the drush-backups folder, with year/month/date/hour/second information.

sobi3ch's picture

@Fidelix this is beautiful

danielnv18's picture

You can clear cache before the dump
 drush cc all && drush sql-dump | gzip -9 > <database>-$(date +%Y-%m-%d-%H.%M.%S).sql.gz