Menu

Install and configure AutoMySQLBackup

AutoMySQLBackup is very useful utility for creating daily, weekly or monthly backups of one or more MySQL databases from one of more MySQL servers. It dumps the databases and compress them in to archives.
it comes with many features such as:

  • Email notification of backups
  • Backup Compression and Encryption
  • Configurable backup rotation
  • Incremental database backups
For Debian based systems execute
apt-get update && apt-get upgrade
For RPM based systems execute
yum -y update
If you are running Debian based distro AutoMySQLBackup is available in the repositories and you can easily install it by executing the following
apt-get install automysqlbackup
If you have a RPM based distro you will have to download AutoMySQLBackup’s installation scripts
wget http://downloads.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz
Create a directory for Automysqlbackup's scripts and unpack the downloaded tar archive
mkdir /opt/automysqlbackup
tar zxvf automysqlbackup-v3.0_rc6.tar.gz -C /opt/automysqlbackup
Once the archive is unpacked run the Automysqlbackup installation script
cd /opt/automysqlbackup
./install.sh

### 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:

success
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.
vim /etc/automysqlbackup/automysqlbackup.conf
And uncommend and set the following confituration directives
CONFIG_mysql_dump_username='root'
CONFIG_mysql_dump_password='YourPassword'
CONFIG_mysql_dump_host='localhost'
CONFIG_backup_dir='/var/backup/db'
CONFIG_do_monthly="01"
CONFIG_do_weekly="5"
CONFIG_rotation_daily=6
CONFIG_rotation_weekly=35
CONFIG_rotation_monthly=150
CONFIG_mysql_dump_port=3306
CONFIG_mysql_dump_compression='gzip'
Once you are done with editing, save the configuration file. All settings are optional and there is 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_dir’ in the configuration file.
mkdir /var/backup
If you want to create a backup of your MySQL databases, run AutoMySQLBackup by executing the following
automysqlbackup
You can also create a crontab entry to run AutoMySQLBackup at a specific time or you can use bellow script
#!/bin/sh

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

chown root.root /var/backup/db* -R
sudo chmod -R a-x+X /var/backup/db

About Author:


I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Next
Newer Post
Previous
Older Post

0 comments:

Post a Comment

 
Top