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
For RPM 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
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
Once the archive is unpacked run the Automysqlbackup installation script
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.
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.
If you want to create a backup of your MySQL databases, run AutoMySQLBackup by executing the following
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
0 comments:
Post a Comment