Backup Mysql via ssh Compressing with GZip

Rating: 
+1
+174
-1
Clone this Snippet

I have a Linode vertual server and was running out of diskspace. So here's a onliner bash command which pipes the output of a 'mysqldump' to a gzip and then ssh out over to another server to backup.

The -c on the gzip tell it to send over to stdout

mysqldump -uUSERNAME -pPASSWORD DATABASE | gzip -c | ssh USERNAME@HOST 'cat > ~/dump.sql.gz
Category: 
Bash