How to install and configure schedule AutoMySQLBackup

How to install and configure AutoMySQLBackup

In this blog article, we will show you how to install AutoMySQLBackup on a Linux or Unix based operating system. AutoMySQLBackup is a very useful utility for creating daily, weekly or monthly backups of one or more MySQL databases. It dumps the databases and compresses them into archives and send email notification.

AutoMySQLBackup Features

  • Email notification of backups on failure
  • Backup Compression and Encryption
  • Configurable backup rotation daily,weekly, monthly
  • Incremental database backups

As usual, log in to your server as user root

[root@local ~]#ssh root@serverip

AutoMySQLBackup  for Debian based systems execute

If you are running Debian based distro AutoMySQLBackup is available in the repositories and you can easily install it by executing the following

[root@sudoadmin ~]#apt-get update && apt-get upgrade
[root@sudoadmin ~]#apt-get install automysqlbackup

AutoMySQLBackup for RPM based systems execute

If you have an RPM based distro you will have to download AutoMySQLBackup’s installation scripts, run and configure them on your server. In this tutorial, we will install Automysqlbackup on a CentOS.

1. Download AutoMySQLBackup

Download the latest version of AutoMySQLBackup to your server

[root@sudoadmin ~]#wget

2. Extract AutoMySQLBackup

Create a directory for Automysqlbackup’s scripts and unpack the downloaded tar archive in that directory

[root@sudoadmin ~]#mkdir /opt/automysqlbackup
[root@sudoadmin ~]#mv automysqlbackup-v3.0_rc6.tar.gz
[root@sudoadmin ~]#cd /opt/automysqlbackup
[root@sudoadmin ~]#tar -zxvf automysqlbackup-v3.0_rc6.tar.gz

3. Install AutoMySQLBackup

Once the archive is unpacked run the Automysqlbackup installation script

[root@sudoadmin ~]#cd /opt/automysqlbackup
[root@sudoadmin ~]#./

### Checking archive files for existence, readability and integrity.

automysqlbackup ... exists and is readable ... md5sum okay :)
automysqlbackup.conf ... exists and is readable ... md5sum okay :)
README ... exists and is readable ... md5sum okay :)
LICENSE ... exists and is readable ... md5sum okay :)

Select the global configuration directory [/etc/automysqlbackup]:
Select directory for the executable [/usr/local/bin]:
### Creating global configuration directory /etc/automysqlbackup:


4. Configuration AutoMySQLBackup

You can use the default paths for the global configuration directory and the directory for the executable. You just have to press Enter when the paths are required.

Next, we have to configure AutoMySQLBackup. Open its configuration file located in the directory we set when we ran the installation script.

[root@sudoadmin ~]#vi /etc/automysqlbackup/automysqlbackup.conf

And uncomment and set the following configuration directives

CONFIG_db_names=( 'databasename1' 'databasename2')
CONFIG_db_exclude=( 'information_schema' )

Once you are done with editing, save the configuration file. All settings are optional and there is the description for all of them, so it is best to check the configuration file for more information about the settings of AutoMySQLBackup.

Create a directory for the MySQL backups. This is the directory we set as ‘/backup’ in the configuration file.

[root@sudoadmin ~]#mkdir /backup

5. Execute AutoMySQLBackup

If you want to create a backup of your MySQL databases, run AutoMySQLBackup by executing the following

/usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf

6. Schedule AutoMySQLBackup

You can also create a crontab entry to run AutoMySQLBackup at a specific time.
eg. backup is scheduled at 1 AM.

[root@sudoadmin]#crontab -e

0 1 * * * /usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf

That’s all. You can check the /etc/automysqlbackup/README file for more information on how to use AutoMySQLBackup.

Leave a Reply

Notify of