Automatically Email MySQL Database Backup

If you are in a shared hosting environment where you are responsible for your own database backups, this is a convenient way to have the server generate a backup file of all of your MySQL databases, compress the file, and email it to the specified address. I’ve added this to the local crontab so that it runs on a regular schedule. In order for it to work, you should have a MySQL user account created with the appropriate privileges in order to access your database.

Leave a Comment