Backing Up MySQL Database with Subversion

While working on a recent Rails project, I wanted to occasionally backup the database to a remote location. Since we were already using Subversion for source control, I figured I could just use it for storing the DB contents as well and came up with a short Ruby script for this, called dbbackup (ironically, stored on a Git repo – I guess it could use a –use-git option ;)

The only Rails tie is that it uses config/database.yml to get the database name and login info, so you could easily adapt it to run on non-Rails projects too. It’s built so that it can be ran by a nightly cron task, and since it’s only sending the diffs it wouldn’t be too resource-heavy.

I wouldn’t use this for Facebook’s production servers, but if your needs are more moderate you might find it useful. Feel free to send over any questions or patches to Here’s the repo URL again, with the script and an explanation on how to use it:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s