Mysql – Incremental MySQL Backup using Subversion

backupMySQLsvn

Our MySQL database servers host several dozens of databases, with dump file size ranging from 1 to ~100 MB.

Currently, our backup approach is mysqldump, wrapped in a shell script, and run from a crontab. This has worked great for us. The only main drawback is large storage requirement to store the dump files.

Since MySQL database dump is a text file, naturally I consider storing it in a version control system, such as Subversion. I recall Subversion only store the delta of a file in each commit.

Is this approach recommended? Are there some gotchas we should aware of?

Best Answer

binlog mentioned by SirStan is good approach.

alternatively you can run mysqldumps and then use rdiff-backup to create backup of dumpfile. rdiff will keep n last backups [ you decide how many ], and will be quite space efficient, since it keeps only full snapshot of latest version of file + set of diffs allowing it to reconstruct previous versions.

whatever you put in svn, stays in svn. repository only grows - so it's good place to keep your sql schemas, source code and maybe docs; but not actual data from sql.