AutoMySQLBackup: Regularly Backup Your MySQL

AutoMySQLBackup is one of the great tools to backup multiple databases, compress the backups, back up remote databases, and email the logs. AutoMySQL lets you take daily, weekly and monthly backups of your MySQL databases using mysqldump (MySQL function to backup the databases).

Install AutoMySQLBackup:

1. Install AutoMySQLBackup:

root@K:/home/kartook# apt-get install AutoMySQLBackup

2. Configure AutoMySQLBackup:

root@K:/home/kartook# nano /etc/default/automysqlbackup

3. See the configuration below:

[…] # Host name (or IP address) of MySQL server e.g localhost
#For remote database, fill the domain or ip address
DBHOST=localhost
[…] # List of DBNAMES for Daily/Weekly Backup e.g. “DB1 DB2 DB3″
# The following is a quick hack that will find the names of the databases by
# reading the mysql folder content. Feel free to replace by something else.
#DBNAMES=”db_ispconfig web1 web2 web3″
DBNAMES=`find /var/lib/mysql -mindepth 1 -maxdepth 1 -type d | cut -d’/’ -f5 | grep -v ^mysql$ | tr \r\n , `
[…] # Backup directory location e.g /backups
# Folders inside this one will be created (daily, weekly, etc.), and the
# subfolders will be database names.
#BACKUPDIR=”/var/lib/automysqlbackup”
#BACKUPDIR=”/path/to/backup/folder/”
[…] # Email Address to send mail to? (user@domain.com)
MAILADDR=”user@domain.com”
[…] 4. Run AutoMySQLBackup:

4. Run AutoMySQLBackup:
automysqlbackup

5. Open the backup folder (default: /var/lib/automysqlbackup)

root@K:/home/kartook# ls -l /var/lib/automysqlbackup

6. You will see the backup files.
7. Add it to cron to run it automatically.

1 thoughts on “AutoMySQLBackup: Regularly Backup Your MySQL

  1. Pingback: AutoMySQLBackup: Regularly Backup Your MySQL | CyberTechBlog.Com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.