[TriLUG] MySql backup

Turnpike Man turnpike420 at yahoo.com
Fri Mar 21 09:25:57 EST 2003


--- Michael Thompson <thompson at easternrad.com> wrote:
> > This will *ONLY* work is you stop mysqld beforehand.
> Oops!  Forgot to add that important point!  Thanks!
> 
> --mwt
> 
> > 
> > An alternative to 'mysqldump -a' is a shell script that uses a
> > for-loop to dump all the databases individually.  Something like
> > (untested, but it's cobbled together from scripts I actually use):
> > 
> > for i in `mysql -B -e "show databases" | tail +2`; do
> >     mysqldump $i | gzip -9 > $i.`date --iso-8601=date`.gz
> >     ls -t $i.* | tail +7 | xargs rm
> > done
> > 

As I have just learned, my copy method was fortunate that the databases I have
are not very active, thus probably no activity when I performed the copy!

So, the above script (which I could have never written on my own)... that is
for online backups of mysql?  Then what process is used to restore?

Thanks,
David M.

> > This will actually date the dumps so you can keep more than one, and
> > remove any that are more than seven days old.
> > 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com



More information about the TriLUG mailing list