How to backup a MySql database from your cpanel control panel

These instructions are for customers of alanchard.com and Hosting for the rest of us, if you purchase your hosting from a different supplier then you may find that they do not work.

These instructions are provided as-is no liability of any kind is accepted for any consequences of their use.

Background

Depending on the hosting package that you have purchased you will be allocated a number of mysql databases. These are used to hold the data for various packages that we provide such as Webcalendar, the Coppermine photo gallery and others. In general each package that you install uses a separate MySql database. You can also install your own software which may also use MySql databases. Within the database information is held in tables containing rows and columns rather like a spreadsheet. Your data will be updated continuously as the packages are used.

Why you need a backup

We do not provide an automatic backup service so it is your responsibility to ensure that your data is backed up at a suitable interval. The appropriate interval depends on the value of the data and how often it changes, but as a guide you should consider the value of the data to your business and the consequences of loss.

How often to backup - what to consider

If you have a mailing list and people sign up to it at the rate of 10 per day then if you backup monthly you risk losing about 300 signups in the worst case of losing the whole database just before you backup again. If you backup every 7 days that number falls to 70 and if you do daily backups it falls to 10.

Backups require somewhere to store them, and they are notorious for taking up a lot of storage space. You need a strategy that will remove old backups after a certain length of time. Consider the mailing list example where a suitable strategy might be:

This strategy means that you always have backups for the current week available, and you have the previous weeks' data too. It should be emphacised that this is a possible strategy and that it may not be suitable for your business. Backup is something that few businesses take seriously until it's too late. Don't wait, formulate your backup plan now, it's too important to put off. Then perform your plan, be zealous in making those backups. Ideally automate the process so that it happens without any intervention from you - that way it will actually get done.

Our service is not suitable for applications where data is of such value that your business would fail if your data was completely lost.

Backup procedure

Log into your account control panel

Begin by logging into your control panel. That's yourdomain.co.uk/cpanel where yourdomain is your website.

log in using your username and password

These screenshots were prepared using the Firefox browser, so you may not see the checkbox inviting you to use the facility to remember your login details.

What you should see when you are logged in.

Here a pink mask has been applied to highlight some of the important parts of the image.

On the left you can see the number of MySql databases that are available, 4 in this case, and the number that are in use, 3 in this example. The backup icon has also been highlighted. Click Backup.

cpanel view

The backup facility

The next screen gives details of all the backups that can be performed and is shown below.

backup facilites

The pink mask has been added to highlight the MySQL database backup section. This example shows that there are three databases, their names are leftseat, webcal and wrdp1. We're going to backup webcal which contains a web calendar. Move your mouse pointer over the work webcal and it will turn into a hand, indicating that this is a link. Click it. You will then be shown the file download box.

Downloading the actual backup file

After clicking the name of the database you will see the following, or similar.

downloading the database backup

Make sure that the Save to Disk radio button is highlighted as shown, then click OK. The file will be downloaded and saved on your computer wherever you store downloaded files, in most cases this will be on your desktop.

Examining the backup file

The backup file is compressed to save space. If your database was large then the file could be several megabytes in size. You can rename it to reflect the details of what it is and when it was produced, then move it to a more suitable location or archive it to off-line media. Here is an example of what the icon will look like, together with the file properties.

backup file properties

Contents of the backup file

If you expand the file using a suitable utility program then open it with a text editor you will be able to see its contents. An example is shown here.

backup file shown as text

This particular example is the web calendar mentioned above.

The file contains all the information needed to set up the database from scratch, plus all the information that was stored in the database at the time that the backup was made. That means that if there was a disaster and the server was lost you would still be able to recover the information. The backup is in a form that is ready to upload back to the server and reconstruct the database.

Last thoughts

Now that your backup is on your local computer you can close your control panel - look for the 'Logout' link in the top right-hand corner of the screen. Then make sure you backup is stored safely.