Backup MySQL Database Daily and Keep for 7 days

Here is a script I quickly wrote to mysqldump a single database and keep 7 days worth of backups. #!/bin/bash # Script – mysqlbackup.sh # Created by Jordansphere – 20/Jun/13 DATADIR=”/home/mysqlbackups” USERNAME=username PASSWORD=password NOW=$(date +”%d-%m-%Y”) #BACKUP DATABASE in date format (eg “MyDatabase-20-6-2013.sql”) /usr/bin/mysqldump -u $USERNAME -p$PASSWORD –databases MyDatabase > /home/mysqlbackups/MyDatabase.$NOW.sql # REMOVE BACKUPS MORE THAN Read More…