Mysql weekly/monthly backup: reliability in simplicity

mysqlI’ve been asked many times to put together mysql database backup with weekly/monthly rotation.
I’m pretty sure there are plenty of such scripts out there on the web.
I am going to add mine so that somebody can compare and choose.

For such tasks shell is the best choice – fast, lightweight in terms of resources and pretty straightforward.

If you are short in disk space you can easily add gzip with piping mysqldump output via gzip. In this case it would be more efficient to drop C from mysqldump options (compression) otherwise whole process will take too much of CPU.
Keep in mind that mysqldump locks the tables so you may want to run it at some off-peak time on your server.
If you want to modify it for your own needs but feeling not very familiar with the language I can recommend [amazon_link id=”0596005954″ target=”_blank” ]Classic Shell Scripting[/amazon_link] or [amazon_link id=”0596009658″ target=”_blank” ]Learning the bash Shell[/amazon_link] books.

Share Button

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">