[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Recommended backup scripts for mysql databases
From:       "Dan Buettner" <drbuettner () gmail ! com>
Date:       2006-06-30 12:17:27
Message-ID: c97ba7a80606300517l232aec44g3bee94baee8a6e86 () mail ! gmail ! com
[Download RAW message or body]

Good morning Andreas -

The --opt flag implies --extended-insert, in addition to some other
options, to generate an optimized (fast) dump file.  See man
mysqldump.  You don't need both but having both shouldn't hurt.

To restore, pipe your dump file back into the mysql client, a la
mysql -u user -ppassword -D database < db_dump20060330

Keep in mind that one dump file may contain data for multiple
databases depending on how you have things set up.  Not really a
problem until you want to restore just one database or just one table
- then you have to get creative.

Dan

On 6/30/06, Andreas Widerĝe Andersen <wodfer@gmail.com> wrote:
> I finally got the script working. Seems to run smooth on my FreeBSD 4.11system:
>
> MYSQLDUMP="`which mysqldump 2>/dev/null`" ||
> MYSQLDUMP="/usr/local/bin/mysqldump"
> MYSQLDUMP_ARGS="--opt --extended-insert -h localhost -umyuser -pmypassword
> mydb"
> ARCHDIR=/backup/mysql
> NAME=db_dump
>
> # Remove archives older than 64 days
> find ${ARCHDIR} -type f -mtime +64 | xargs rm -f
> # Create new archives
> cd ${ARCHDIR} && ${MYSQLDUMP} ${MYSQLDUMP_ARGS} > ${NAME}.`date +%Y%m%d`
>
> I just have two more questions:
>
> Should I use --extended-insert or not? I guess I can use both, but what is
> recommended?
>
> What would the correct script/way to restore the database?
>
> Thanks,
> Andreas
>
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic