Added on Jun 11th, 2012 and marked as backup database mysql

Lets use AutoMySQLBackup to create backups of the MySQL-databases.


Download the latest version from AutoMySQLBackup, extract the archive and follow the installation instructions.

At the moment the most recent version is 3.0-rc6:

mkdir /tmp/amb
cd /tmp/amb
tar xvfz automysqlbackup-v3.0_rc6.tar.gz


Create a folder to store the backups:

mkdir -p /srv/backup/db

and edit the configuration file /etc/automysqlbackup/automysqlbackup.conf to include the line:


Set the MySQL user credentials (using the same file):

CONFIG_mysql_dump_username='user'        # Probably 'root'

Schedule backups

Add the backupscript to the crontab of root (crontab -e):

# m h  dom mon dow   command
0  4   *   *   *     /usr/local/bin/automysqlbackup >> /var/log/cron.log


You could get the following error:

mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES

This has to do with the MySQL version (>5.5) and the performance_schema database. Adding --skip-lock-tables to the mysqldump command will fix this. However, since mysqldump is called by automysqlbackup, this is easier said than done. So, we’re going to edit /etc/mysql/my.cnf and add these lines to the mysqldump section: