Its useful if you are directadmin user and want to have your database copies and save them on the same hosting account as your website.
#!/bin/bash
#Author: Vitalijus Ryzakovas - www.balticservers.com
current=$(date +%F)
if [ -d /home/user/databasebackup ]; then
delete=$(ls -r /home/user/databasebackup | tail -n +7 )
/bin/mkdir /home/user/databasebackup/$current
/usr/local/mysql/bin/mysqldump -u user -ppassword --all-databases > /home/user/databasebackup/$current/user_alldb.sql
[ -z "$delete" ] || rm -rf /home/user/databasebackup/$delete
fi
Then you need create cronjob and run it everyday.