Backup Mysql via ssh Compressing with GZip
Rating:
Clone this SnippetSubmitted 7 years 6 months ago by peter.
- Log in to post comments
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