DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

MYSQL Backup

08.22.2006
| 1795 views |
  • submit to reddit
        // shell script to backu a mysql database

#!/bin/sh

RM=/bin/rm
MV=/bin/mv
TAR=/bin/tar
GZIP=/bin/gzip
CHOWN=/bin/chown

DUMP=/usr/bin/mysqldump

BDIR=/mnt/mrynas/backups/fogbugz

DATE=`date +%Y%m%d`

echo Dumping mysql database as
echo $BDIR/mysql.$DATE.gz
$DUMP --opt -c -e -Q mysql | gzip > $BDIR/mysql.$DATE.gz