How do I send a file as an email attachment using Linux command line?

后端 未结 26 3200
盖世英雄少女心
盖世英雄少女心 2020-11-22 04:39

I\'ve created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them togeth

26条回答
  •  我在风中等你
    2020-11-22 05:14

    From source machine

    mysqldump --defaults-extra-file=sql.cnf database | gzip | base64 | mail me@myemail.com
    

    On Destination machine. Save the received mail body as db.sql.gz.b64; then..

    base64 -D -i db.sql.gz.b64 | gzip -d | mysql --defaults-extra-file=sql.cnf
    

提交回复
热议问题