MySQL is one of the most popular open source database management system for the development of interactive websites.
If your server stores its sensitive data in a MySQL database, you
will most definitely want to backup that information so that it can be
restored in case of any disaster.
Below is a backup script for MySQL databases (please make sure you will change MYSQL_PASS):
09 | MYSQLDUMP=$( which mysqldump) |
14 | ARG= "-u $MYSQL_USER -p$MYSQL_PASS" |
15 | DATABASES=$($MYSQL $ARG -s -e "SHOW DATABASES;" ) |
16 | BACKUP_PATH= "/home/backup/$DATE/mysql" |
18 | ! [ -d $BACKUP_PATH ] && mkdir -p $BACKUP_PATH |
22 | BACKUP_FILE= "$BACKUP_PATH/$HOSTNAME-mysql-$DB-$DATE.sql.gz" |
23 | $MYSQLDUMP $ARG $DB | $GZIP -9 > $BACKUP_FILE |
No comments:
Post a Comment