Category: Linux
vi /path/backup.sh
#/bin/sh
# all db separate files
for customerdb in `mysql -uusername -ppassword -e "show databases" -B -N`
do
echo $customerdb
mysqldump -uusername -ppassword $customerdb > /path/$customerdb.sql
done
Add cron job
vi /etc/crontab
* 0 * * * root /path/backup.sh
Tags:
Linux