# Ruby and MySQL backup

**URL:** <https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898>\
**Category:** Rails\
**Created:** [October 14, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898 "2008-10-14T19:56:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [October 14, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898/1 "2008-10-14T19:56:34Z")

</div>

I suspect this is not exactly a Ruby/Rails topic but I also suspect  
that lots of people here have already solved this issue. We have a  
simple app running on a SliceHost slice and we’d like to backup the  
database both hourly and daily to an AWS S3 account.  
I’ve looked around but surprisingly can’t seem to find anything that  
offers a complete solution for doing this. I was hoping to find a ruby  
solution but so far nothing. I suspect that it’s not a super hard  
thing to do but it’s not really my specialty so I was hoping someone  
here might simply point me in the right direction - perhaps a blog  
post or something similar.

Dale

---

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [October 15, 2008, 7:51am UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898/2 "2008-10-15T07:51:37Z")

</div>

PeteSalty wrote:

> I suspect this is not exactly a Ruby/Rails topic but I also suspect  
> that lots of people here have already solved this issue. We have a  
> simple app running on a SliceHost slice and we’d like to backup the  
> database both hourly and daily to an AWS S3 account.  
> I’ve looked around but surprisingly can’t seem to find anything that  
> offers a complete solution for doing this. I was hoping to find a ruby  
> solution but so far nothing. I suspect that it’s not a super hard  
> thing to do but it’s not really my specialty so I was hoping someone  
> here might simply point me in the right direction - perhaps a blog  
> post or something similar.
> 
> Dale

You could setup a cron job to do it as you mentioned [mysqldump]. You  
could try a mysql table syncer  
[http://code.google.com/p/ruby-roger-useful-functions/wiki/TableSyncer](http://code.google.com/p/ruby-roger-useful-functions/wiki/TableSyncer)  
Cheers.  
-=r

---

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [October 15, 2008, 11:18am UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898/3 "2008-10-15T11:18:43Z")

</div>

I always use automysqlbackup  
([AutoMySQLBackup download | SourceForge.net](http://sourceforge.net/projects/automysqlbackup/)). It’s not ruby, but  
it’s damn fine for backing up MySQL especially if you need to backup  
several databases on the same server.

---

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [October 16, 2008, 10:00am UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898/4 "2008-10-16T10:00:02Z")

</div>

On 15 Oct 2008, at 11:18, Christian J. wrote:

> I always use automysqlbackup  
> ([AutoMySQLBackup download | SourceForge.net](http://sourceforge.net/projects/automysqlbackup/)). It’s not ruby, but  
> it’s damn fine for backing up MySQL especially if you need to backup  
> several databases on the same server.

I use my own bash Shell script. It commits all the database dumps to a  
git repository and then pushes it to a central repository (but the  
script could just as easily be modified to use svn or mercurial  
or …). That way you have versioned backups both on the local machine  
as on a remote host (or hosts even) going back as far as you want.  
Then just let a cron take care of executing the script as frequently  
as you want.

[http://pastie.org/293699](http://pastie.org/293699)

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![PeteSalty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bc79bd/32.png) [@PeteSalty](https://www.ruby-forum.com/u/PeteSalty)\
**Post date:** [November 14, 2008, 1:53pm UTC](https://www.ruby-forum.com/t/ruby-and-mysql-backup/150898/5 "2008-11-14T13:53:33Z")

</div>

Thanks a lot Peter!
