Category: General

* Setup backup.sh file in /root folder

mkdir /var/lib/mysql_backup
vi /root/backup.sh
#/bin/sh
# all db separate files

for customerdb in `mysql -uuser -e "show databases" -B -N`
do
        echo $customerdb
        mysqldump -uuser $customerdb > /var/lib/mysql_backup/$customerdb.sql
done
chmod 700 /root/backup.sh

* Setup Crontab so backup runs at mighnight every night

vi /etc/crontab
0 0 * * * root  /root/backup.sh

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count: