themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to dump remote MySQL database to a local file

$ ssh <user@server> "mysqldump --user=<dbuser> --password=<dbpassword> \
  <dbname> | bzip2 --stdout --force" | bzip2 --decompress --stdout \
  > <dbname>_$(date +%Y-%m-%d_%H:%M:%S).sql

To dump data only:

$ ssh <user@server> "mysqldump --user=<dbuser> --password=<dbpassword> \
  --compact --no-create-info --complete-insert \
  <dbname> | bzip2 --stdout --force" | bzip2 --decompress --stdout \
  > <dbname>_$(date +%Y-%m-%d_%H:%M:%S).sql