This article describes how to use the AutoMySQLBackup tool to back up MySQL databases.
AutoMySQLBackup is a flexible script that enables you to create backups at varying intervals, such as daily, weekly, and monthly. By rotating your backups, you can preserve storage space on your account. You can even send backup files to external e-mail accounts for off-site backup redundancy.
To download and install AutoMySQLBackup on your account, follow these steps:
tar xvzf automysqlbackup-v3.0_rc6.tar.gz
To install AutoMySQLBackup, type the following command:
After you download and install AutoMySQLBackup, you can configure the settings for your own environment. To do this, follow these steps:
CONFIG_mysql_dump_username='username' CONFIG_mysql_dump_password='password' CONFIG_backup_dir='/home/username/mysqlbackups'
To specify specific databases to back up, remove the pound sign (#) from the start of the following line, and change the value to the databases you want to back up:
To specify rotation settings for the different backup intervals, remove the pound sign (#) from the start of the following lines, and then change the values to the rotation settings that you want:
CONFIG_rotation_daily=6 CONFIG_rotation_weekly=35 CONFIG_rotation_monthly=150
To send backup files to an e-mail account, remove the pound sign (#) from the start of the following lines, and then modify them as shown. Replace [email protected] with the e-mail address where you want to send the backup files:
CONFIG_mailcontent='files' CONFIG_mail_use_uuencoded_attachments='yes' CONFIG_mail_address='[email protected]'
After you configure AutoMySQLBackup for your environment, you can run backups. To run a backup manually using AutoMySQLBackup, type the following command. Replace path with the path to the myserver.conf file:
However, you will most likely want to automate the process and create backups automatically. To do this, you can set up a cron job that runs the following command. Replace the username and path values as required by your own configuration:
For more information about how to use cPanel to create a cron job, please see this article.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.