Tuesday, February 22, 2011

Mysql backups

I have found the most wonderful tool for backing up mysql databases. It's not new... it's just that I've only found it recently!

automysqlbackup does exactly what is says on the tin - it backs up your mysql database. There are some great todos, but I thought I'd post what I did on out Plesk servers so that I've got it noted down for the future!

sudo -s

mkdir /var/mysql

mv automysqlbackup /usr/local/bin/

ln -s /usr/local/bin/automysqlbackup /etc/cron.daily/automysqlbackup

joe /etc/crontab (edit the time that the daily cron takes place and save)

When setting up automysqlbackup, these are the settings I used:

### START CFG ###

# Username to access the MySQL server e.g. dbuser

USERNAME=admin

# Password to access the MySQL server e.g. password

PASSWORD=YourAdminPasswordForPlesk

# Host name (or IP address) of MySQL server e.g localhost

DBHOST=localhost

# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"

DBNAMES="all"

# Backup directory location e.g /backups

BACKUPDIR="/var/mysql/"

# Mail setup

# What would you like to be mailed to you?

# - log : send only log file

# - files : send log file and sql files as attachments (see docs)

# - stdout : will simply output the log to the screen if run manually.

About Me

I'm a Christian, husband to my wonderful wife, and father to three great boys.

I'm a radiologist who loves technology and is passionate about using the social and open web in medicine. After radiology training in Leeds, I completed a paediatric radiology fellowship at the Royal Children's Hospital in Melbourne.

I now work in Edinburgh as a Consultant Paediatric Radiologist with half my time dedicated to undergraduate radiology Education. I'm also a Managing Editor at Radiopaedia.org.