mysqldump to a tar.gz

mysqldump --opt <database> | gzip -c | ssh user@wherever 'cat > /tmp/yourfile.sql.gz'

You can’t use tar in a pipe like this, and you don’t need it anyway, as you’re only outputting a single file. tar is only useful if you have multiple files.

Leave a Comment