MySQL-Maintenance-Buddy is a application which handles MySQL database backups
and database optimization for daily maintenance.
Copyright © 2009, Nik Wolfgramm
- create MySQL backups using mysqldump for all or some databases
- restore databases from backups
- optimize database tables using mysqlcheck
- delete old database backups based on retention time
- show current databases and backups
- collect some maintenance stats such as duration of maitenance and number of db’s backed up
- send a maintenance summary by email
- log actions to logfile
See mysqlmb.rb —usage for a full list of options
Launch the ruby script:
mysqlmb COMMAND [options]
See mysqlmb -? for usage.
List of dependencies:
- Ruby
- MySQL tools (mysql, mysqldump, mysqlcheck)
- command line with some standard utilities (echo, bzip2)
- Download mysqlmb and move it to the desired application directory (i.e. /usr/local/mysqlmb)
- Create a symlink in order to have mysqlmb in your execution path
ln -s /usr/local/mysqlmb/mysqlmb /usr/local/sbin/mysqlmb
- Have a mysql user with backup/optimization rights available
- Minimal rights for backups: SELECT, RELOAD
- for optimizations: LOCK TABLES
- example user creation with mysql cmd-tool:
GRANT SELECT, RELOAD, LOCK TABLES ON *.* TO backup@localhost IDENTIFIED BY 'password';
- start automating MySQL maintenance tasks using MySQL-Maintenance-Buddy!