Backup and Email a MySQL Database

Posted on December 3, 2007 by Ben Cecka

I know there are a hundred and fifty scripts that do this, but I set out to do this within a single Crontab entry. I thought it would be nice to post and save others from having to suffer with combining a bunch of ridiculous scripts for such a simple task.

mysqldump -uusername -ppassword –all-databases | gzip > /pathto/db.gz && mutt -s Backup -a /pathto/db.gz email@domain.com < /dev/null

Voila. All data to be changed has been italicized to protect the innocent (and help you).

Technorati Tags: , ,

Comments

Leave a Reply




  •   Feed
  • Prefer email updates?
  • About Me

    I'm the Director of Information Technology for Crown Mailing Center, a retail shipping solution provider and franchise company. I've been involved in software design, web applications, managing help desk operations, and corporate technology deployment strategies.

  • Twitter

    • Write Me

    • ben@cecka.org
    • Find Me

    • Facebook
    • Orkut
    • LinkedIn
    • Last.fm
    • Digg
    • Twitter
    • Pownce
    • Kongregate