Install and Configure AutoMySQL Backup on Centos

Install and Configure AutoMySQL Backup on Centos

AutoMySQL backup is a utility for creating daily, weekly, monthly backups of the MySQL databases on your server. It generates the backups of the databases and compress them in to archive files. AutoMySQL backup comes along with a lot of features like

1) Backup compression and Encryption

2) Configurable backup rotation

3) Email notification of Backups

4) Incremental database backups

For Debian based distros AutoMySQL backup is available in the repositories and can be installed easily by executing the following commands.

# apt-get install automysqlbackup

Let’s have a look into the installation process of AutoMySQL backup on Centos

1) Login to server via SSH.

# ssh root@IP

2) Download the AutoMySQL backup tar file.

#wget https://sourceforge.net/projects/automysqlbackup/files/latest/download?source=navbar

3) Create a directory in /opt and extract the downloaded file.

# mkdir /opt/automysqlbackup

# mv automysqlbackup-v3.0_rc6.tar.gz

# cd /opt/automysqlbackup

# tar -zxvf automysqlbackup-v3.0_rc6.tar.gz

4) After the extraction install the AutoMySQL backup

# ./install.sh

You can use the default path for the global configuration directory and the directory for the executable. You only need to press the “Enter” key when the paths are required.

5)  After the installation, you have to configure AutoMySQL backup. Open the configuration file with your favorite text editor.

# vi /etc/automysqlbackup/automysqlbackup.conf

Uncomment and set the following configuration directives.

CONFIG_mysql_dump_username=’root’

CONFIG_mysql_dump_password=’YourPassword’

CONFIG_mysql_dump_host=’localhost’

CONFIG_backup_dir=’/backup/db’

CONFIG_do_monthly=” ”

CONFIG_do_weekly=” ”

CONFIG_rotation_daily=

CONFIG_rotation_weekly=

CONFIG_rotation_monthly=

CONFIG_mysql_dump_port=

CONFIG_mysql_dump_compression=’gzip’

You can configure the AutoMySQL backup by changing the values according to your needs.

6) Create a directory for the MySQL backups. In the configuration we have mentioned the directory /backup/db.

# mkdir /backup/db

7) To run the AutoMySQL backup execute the following command.

# automysqlbackup

8) If you want you can schedule the AutoMySQL backups to run on a specific time by creating a cronjob.

# crontab -e

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

Here the backup is scheduled at 2 AM.

Hence we have successfully installed and configured AutoMySQL backup on Centos.

Leave a Reply