6 Steps to Back Up Your Blog Database with AutoMySQLBackup

There are a few ways for you to back up your blog database, such as to download the database from your cPanel, to export the database from your phpMyAdmin, or to save the database with some WordPress plugins.

And for most WordPress blogs like Free Nuts, which Unix-based web hosting offers Control Panel (cPanel), it will be easy to back up your blog database with a light script AutoMySQLBackup. The benefit to use AutoMySQLBackup is that you do not need to install any plugin in your WordPress, you can send your database backup to your email box or save it in your server, you can back up multiple databases at a time, and of course, the backup will be launched automatically every time.

To install AutoMySQLBackup and back up your blog database, just follow below 6 simple and easy steps.

Step 1. Download the AutoMySQLBackup file

Visit AutoMySQLBackup and download the file with below name:

automysqlbackup.sh.2.5

Then, rename the file name to “automysqlbackup.sh”.

Step 2. Create a backup directory

In order to save your blog database’s backup, you need to create a new directory with any name you like in your server, and you can put the directory anywhere as you like, but for security concern, you’d better create the new directory in the root directory, together with the public_html directory, so that others won’t access your backup.

Let’s name the directory “backups” here for example, so the location of backups is something like below:

/home/young/backups

Just remember to change my name Young to your cPanel username.

Step 3. Upload the AutoMySQLBackup file

Upload the file automysqlbackup.sh to your new directory “backups” with FTP software or cPanel, I recommend you to use cPanel, since which will be used in the following steps.

Step 4. Change Permissions

Open File Manager in your cPanel, find and select the automysqlbackup.sh file, click the Change Permissions, and set the Permission to 755.

Step 5. Edit the AutoMySQLBackup file

After the permission is changed and saved, edit the automysqlbackup.sh file with the default encoding. Although there are many contents inside the sh file, you only need to edit below 7 places:

# Username to access the MySQL server e.g. dbuser
(1)USERNAME=Input your blog database username here.

# Username to access the MySQL server e.g. password
(2)PASSWORD=Input the password of the database username here.

# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost

# List of DBNAMES for Daily/Weekly Backup e.g. “DB1 DB2 DB3″
(3)DBNAMES=”Input your database name here. If you have more than one database, just separate them with space, or you can input ‘ALL’ instead.”

# Backup directory location e.g /backups
(4)BACKUPDIR=”Input your new directory location here, such as ‘/home/young/backups’.”

# Mail setup
# What would you like to be mailed to you?
# – log : send only log file
# – files : send log file and sql files as attachments (see docs)
# – stdout : will simply output the log to the screen if run manually.
# – quiet : Only send logs if an error occurs to the MAILADDR.
(5)MAILCONTENT=”If you want and can send the database backup to your email box, input ‘files’ here, or just input ‘log’, ‘stout’ or ‘quiet’.”

# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
(6)MAXATTSIZE=”No need to change if your database backup is less than 4MB, just keep the default number 4000.”

# Email Address to send mail to? ([email protected])
(7)MAILADDR=”Input your email box address here.”

Excerpt(5)&(6), all the other 5 places should be changed, and DO NOT remove the double quotation marks(“”).

When the edition of the AutoMySQLBackup file is finished, you are easy to take the last step.

Step 6. Create a cron job

Open the Cron jobs in the cPanel Advanced item, input your email address (same as the one in step 5), set the time when you want the system to back up your blog database, and input the location of the automysqlbackup.sh file in the Command column, the location should be like below:

/home/young/backups/automysqlbackup.sh

Click the button Add New Cron Job, then you will finish the backup setup with the AutoMySQLBackup script, and your blog database will be sent to your email box as well as saved in your server automatically according to your schedule.

Cool, right? BUT, if there is no Mutt email client installed in your Unix-based web hosting, you won’t receive any backup database via email, since the email attachment function of AutoMySQLBackup is only workable for those servers with Mutt installed. Free Nuts is hosted on BlueHost which does not support Mutt, so I failed to send the database backup to my email box via AutoMySQLBackup.

If you have any idea to send the database backup to an email box via the script AutoMySQLBackup, or if you have any other scripts to back up blog databases, welcome to share with us by adding a comment.

Related free web apps:

  1. 5 Different and Free Ways for You to Back Up Your Blog Database
  2. Top 10 Free WordPress Plugins for Database Backup
  3. How To Import Database Via SSH
  4. How to Reinstall Firefox
  5. How To Move WordPress To A VPS Or Dedicated Server

This entry was posted in Other Free Nuts and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
Post comment as twitter logo facebook logo
Sort: Newest | Oldest

Good help!

However, it seems to me that if users are unable to access the server console, then there is no way to backup the MySQL directly over the website,but if can , this is exactly what I need. Installed and works a treat. You mentioned you can set it up to backup with AutoMySQLBackup for all blogs

This trick, if it works how I want it to, could potentially save me $$$'s a year.

Thank you so much!! :)

Martyn Keigher
www.rdplive.co.uk

An alternative website backup software similar to AutoMySQLBackup is backupsmart it is fully automatic on schedule as well

Both are great cpanel website software anyway

Is there a windows version automysqlbackup?

@Kobena I only know this one. :-)

AutoMySqlBackup is a great script and I have used it for years.

But I have one database that is very large and the resulting restore script gets too large. I had to restore only one table and loading the script in my editor was not possible because the editor could not load this big a script.

I recently found a simple solution to this on this website: http://moinne.com/blog/ronald/mysql/backup-large-databases-with-mysqldump

The script does not do the fancy daily-weekly-monthly backup stuff that AutoMySqlBackup does, but it makes restoring my database, or only one or two tables a breeze.

Regards, Hans