Ruby
Pull request Compare This branch is 6 commits ahead of christianhellsten:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib
test
.gitignore
LICENSE
README.textile
Rakefile
VERSION
mysql_backup.gemspec

README.textile

mysql-backup

A command line tool that backups all MySQL database instances it can find on a MySQL server.

Installation


  $ sudo gem install mysql_backup —source http://gemcutter.org

You can also grab the source code and install with rake:


$ cd /usr/local/src $ git clone git://github.com/christianhellsten/mysql-backup.git $ cd mysql-backup $ sudo rake install

Configuration

Configuration is easy, just run the built-in mysql_backup_install command:


  $ sudo mysql_backup_install

The installation script will ask you to enter all necessary information and then writes the configuration to /etc/mysql_backup.

Usage

Taking a backup of all databases is also easy:


  $ sudo mysql_backup

This will backup all databases, except the ones defined in the configuration file using the skip parameter.

Scheduled backups with cron

Open the cron configuration with the following command:


$ sudo crontab -e

Add the following:


PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash

# m h  dom mon dow   command

# Backup all MySQL databases every night at 24:00

00 00 * * * mysql_backup

Sample configuration


user: root
password: xxx
host: localhost
dir: /var/backup
format: %d-%m-%y
keep: 10

mysqldump:
  options: -Q -c -C --add-drop-table --add-locks --quick --lock-tables
  path:
skip: [mysql, test, information_schema]

TODO

  • Refactor
  • List dependencies
  • Handle command line errors gracefully
  • Nice

Author

Christian Hellsten (Aktagon Ltd.)