[TriLUG] MySql backup
Michael Thompson
thompson at easternrad.com
Fri Mar 21 09:23:23 EST 2003
> This will *ONLY* work is you stop mysqld beforehand. Otherwise, you
> have no guarantees that the files will not be updated while you are in
> the process of copying.
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
>
> This will actually date the dumps so you can keep more than one, and
> remove any that are more than seven days old.
>
> As a bonus, I'll even spare you a rant as to why MySQL is a great ISAM
> database but a poor SQL one, and why you should be using PostgreSQL
> for any serious database usage.
>
> Mike
> --
> Speak in extremes, it will save you time -- Tin Machine
> _______________________________________________
> TriLUG mailing list
> http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ:
> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>
More information about the TriLUG
mailing list