Wednesday, April 10, 2013

Taking backup of MySQL database through email form crontab.


0 4 * * * /usr/bin/mysqldump --opt -u root –p rootpass db_name | gzip > /opt/ DB_Backup/database_name.sql.gz | /bin/echo "Your MySql DB backup successfully taken" | /bin/mail -s"MySQL DB network_complaint Backup Successfully Completed" test01@yahoo.com -c test02@yahoo.com

In this crontab example, the MySQL database dump shell script will be run every day, at four minutes after midnight. Once again, adjust this as desired.

No comments:

Post a Comment