[Lias] MySQL backup

Craig Ringer craig at postnewspapers.com.au
Thu Jul 17 08:40:02 UTC 2003


Les Bell wrote:
> Tom Doyle <tom at stvincents.nsw.edu.au> wrote:
> 
> 
> What can I schedule MySQL database backups with?
> <<
> 
> How about a cron job in the middle of the night that does:
> 
> mysqldump -p<password> --opt <database> | gzip -c - > <filename>.gz
> 
> ? You can restore it with
> 
> zcat <filename>.gz | mysql -C <database> -p<password>
> 
> Nice and simple, and can be easily turned into a script that maintains
> multiple revisions of backups, etc.

Using 'date -I' can be very handy with your backups. Even though you're 
writing to some removable media as well, it can be handy to have 
multiple on-line copies of the backups in case you need one.

mysqldump -p<password> --opt <database> | gzip -c - > <filename>.`date 
-I`.gz




More information about the lias mailing list