Backup mysql database script

From Wiki

Revision as of 18:35, 23 January 2006 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/bin/bash
# Created by Bryan Le Gear - Skynet 2005/10/12
#
# This script must be run by dbadmin
# and this user must have the root password
# configured in ~/.my.cnf
#

COMPRESS=gzip MYSQLDUMP=mysqldump MYSQLDUMP_ARGS="-u root -p --lock-tables=false --all-databases" CURRDATE=`date +%d-%m-%Y` BACKUPDIR=/home/backup OUTFILE=$BACKUPDIR/mysqlbackup_$CURRDATE.sql.gz echo echo "Backing up to: " $OUTFILE echo "Compressing using: " $COMPRESS $MYSQLDUMP $MYSQLDUMP_ARGS | $COMPRESS > $OUTFILE echo "Chmoding to: 400" chmod 400 $OUTFILE
Personal tools