17 messages in com.mysql.lists.mysqlRe: Recommended backup scripts for my...
FromSent OnAttachments
Andreas Widerøe Andersen27 Jun 2006 02:44 
Daniel da Veiga27 Jun 2006 04:19 
Timur Izhbulatov27 Jun 2006 04:45 
Dan Buettner27 Jun 2006 05:49 
Tim Lucia29 Jun 2006 04:25 
Gerald L. Clark29 Jun 2006 06:06 
Dan Buettner29 Jun 2006 06:26 
Andreas Widerøe Andersen29 Jun 2006 07:43 
Dan Buettner29 Jun 2006 07:53 
Daniel da Veiga29 Jun 2006 08:01 
Tim Lucia29 Jun 2006 14:35 
Dan Buettner29 Jun 2006 15:01 
Tim Lucia29 Jun 2006 16:06 
Dan Buettner29 Jun 2006 16:25 
Andreas Widerøe Andersen30 Jun 2006 00:46 
Dan Buettner30 Jun 2006 05:17 
Andreas Widerøe Andersen01 Jul 2006 03:52 
Subject:Re: Recommended backup scripts for mysql databases
From:Timur Izhbulatov (Timu@oilspace.com)
Date:06/27/2006 04:45:50 AM
List:com.mysql.lists.mysql

On Tue, Jun 27, 2006 at 08:19:41AM -0300, Daniel da Veiga wrote:

On 6/27/06, Andreas Widerøe Andersen <wod@gmail.com> wrote:

Hi, I have a few FreeBSD servers running various web/database things and I'm looking for a good a reliable backup script that I can run through a cronjob. I'm currently running the latest version of mysql323, but will upgrade to version 4.1 soon aswell as upgrade most of the servers to the latest FreeBSD version.

Any good suggestions to a script that will back up my databases and make things ready for an easy restore if I need to?

30 23 * * * date=`date -I` && /usr/bin/mysqldump --opt -B -C -h<host> -<user> -p<password> <database> | bzip2 -c > path/to/backup/$date-<database>.sql.bz2

I guess it will work on a FreeBSD, its my own cron job here...

I would also suggest removing old archive copies:

MYSQL="`which mysql 2>/dev/null`" || MYSQL="/usr/local/bin/mysql" MYSQL_ARGS="--opt -h localhost -uuser -ppass db" ARCHDIR=/usr/local/db/blah NAME=db_dump

# Remove archives older than 64 days find ${ARCHDIR} -type f -mtime +64 | xargs rm -f

# Create new archives cd ${ARCHDIR} && mysqldump ${MYSQL} ${MYSQL_ARGS} > ${NAME}.`date +%Y%m%d`

Cheers,