When launched by cron, this script provides a quick solution to scheduled rolling database backups.
Copy the script to your server then set the config variables including the target directory, database and credentials located at the top of the file.
Make the script executable:
chmod +x database_backup.sh
Run the script:
./database_backup.sh
Verify that a valid backup is in the target directory.
Schedule the script to whatever frequency you want using cron:
crontab -e
Example of every day at 7am:
0 7 * * * /home/codemonkey/database_backup.sh