Backup mysql database tutorial

Database backup is essential to secure your website from any unforseen problems. You never can tell what could come up and create problems. When you bacup your data, you are actually securing yourself from a potential loss.

Many internet users never take database backup seriously. An estimated 25 percent of web uses never backup their data and eventually when disaster comes, they are overtaken and may never be able to recover or take a very long time to recover from the loss.

The safe path is to have a clean backup so that you can roll back in case there be a problem which becomes irrepairable or so difficult to fix. In very difficult times, falling back on a backup is always the most reliable and dependable solution to the problem.


You will also want to read:

Best practices for managing MySQL databases

MySQL Database Tutorial

CPanel Security

CPanel Login Tutorial

CPanel Account Information Tutorial

How To Create, Edit, and Delete a File in CPanel Using File Manager

I have a full backup of account through cPanel. How do I restore it?

 

How to backup your database


There are two approaches to backup your database. You can use the cPanel backup tool ot you use the phpMyAdmin database tool. Both ways, you will have a backup for your database.


Using the phpMyAdmin Tool to Backup Your Database


To begin a database backup with phpMyAdmin, you should access the phpMyAdmin tool available in your cPanel:

  • Select the database that you would like to backup from the Database menu (located in the upper left corner of the page). A new page will be loaded in phpMyAdmin showing the selected database.
  • Scroll to the buttom and make sure the "check all" tab is checked. That will higlight all your database tabels.
  • To proceed with the backup click on the Export tab: The options that you should select apart from the default ones are Save as file (which will save the file locally to your computer in an .sql format) and Add DROP TABLE (which will add the drop table functionality if the table already exists in the database backup).
  • Click on the Go button to start the export/backup procedure for your database: A download window will pop up prompting for the exact place where you would like to save the file on your local computer. It is possible that the download starts automatically. This depends on your browser's settings.


Also read:
Cannot See My Website Online After Upload, Why?
Character encoding in cPanel file manager
Custom error page is not working
Default Home Directory Folders
Getting Familiar With the cPanel User Environment

This method is a saf and very effective way to backup your database because it saves to your local computer.

Option 2: Backup with the cPanel Backup Tool

The backup tool is found under the files section of the control panel. To use this method, follow these steps:

  • Login to your website control panel using the required login credentials.
  • From withing the files section of your control panel, clic on backup.
  • Under patial backups, scroll down to Download a MySQL Database Backup
  • Clickk on the database you want to backup and a pop up window will request you download the database to your local computer.


Those are the two ways to backup your database.

Also read:

How Do I Create and Delete a Parked Domain
How do I create and remove an Addon Domain?
How to Backup My Website in cPanel
How to Create a MySQL Database, a User and Delete Database in Cpanel

Restoring a database from a backup


To restore (import) a database from a backup, you will still have to use the phpMyAdmin tool within your control panel. First choose the database you'll be importing data into. This can be done from the corresponding menu on the left. Then click the Import tab:

You have the option of importing an .sql file which should have been generated from the backup eplained in the tutorial above. Choose the file from your local computer. Note that you are given the option to pick the character set of the file from the drop down-menu just below the upload box. If you are not certain about the character set your database is using just leave the default one.


In order to start the restore click on the Go button at the bottom-right. A notification will be displayed upon a successful database import. That will be all for database backup and restore.

That is all. You now know how to backup a database.

Why Do You Need a Backup

If your website gets constant updates, then it is really impotant that you keep a current backup of your website. With your new and ever changing content, you can have, with a backup, an updated and safe copy of your website. If you update so frequently, then it will be good to have multiple backups for your website.

Having a Backup is a Safe policy

Sometimes, you may want to think that your web host should be maintaining a backup for you and so you need not bother about eeping your own backup. The fact is your web host may or may not keep a backup for you. Sometimes, when they do, they may not maintain regular backups to suit your needs. So it is better not to solely rely on the backup service provided by your web host.


Backups Minimize the Fallout if Your Website is Compromised

No website can claim to be completely free from the ris of an attack. The thing is certain steps and precautions can help reduce this possibility but the risk of an attack cannot be completely eliminated. The good thing with having a full backup for your entire website is that when any of these disasters come by, instead of trying to identify the error and remove backdoors and the attacker codes, you simply revert to your recently save and functional backup and then proceed to address the security issues which led to the attack. Even if you have the capacity and tools to identy and fix the breaches, it is recommended when teir is no backup.

Types of Backup Files Found in cPanel

When you have a backup file, you will need to know what type of backup it is so you can know what is saved inside. Below are examples of the format for the various backup file names along with descriptions to help you determine the contents of a backup.
Full cPanel Backup

backup-5.18.2017_18-46-23_cpaneluser.tar.gz

This is the format of a full backup file. It includes your home directory, including addon domains and subdomains, databases, email forwarders and filters.
Home Directory Backup

backup-domain.com-5-18-2017.tar.gz

This is the format of a home directory backup file. It includes all of the files in your home directory that you own as well as files which you do not own but have access to.
MySQL Backup

database_name.sql.gz

This is the format of a MySQL backup file. It only includes the data of a single database.
Email Forwarders Backup

aliases-domain.com.gz

This is the format of an Email Forwarders backup file. It includes all forwarders you've created in cPanel.
Email Filters Backup

filter_info.cpaneluser.yaml.gz

This is the format of an Email Filters backup file. It includes all account-level and user-level filters you've created in cPanel.

Where to Keep Backups

Backups can be ept on your web hosting account but it is safer not to just have them there. This is because if your site has been attacked it’s possible that your backups could also have also been compromised in the attack. Having your files stored safely off your hosting account will alleviate this possibility.

Backkup Protect Against Upgrade Problems with CMS


Upgrading and updating content management systems like Joomla, WordPress and Magento can come with lots of issues. Sometimes, the new version may not be compatible with your plugin and this can create problems and give room for eploitations. When this happens, falling back on a functional and safe backup is a good idea to address the problem.

Todhost Automatic Backup Policy

Todhost does provide automatic backup service which runs once a week on a random day. Each fresh backup overwrites any previous backups. Only one week of backups are kept at a time. The terms of our backup policy vary depending on the type of hosting account. It is uncertain that a bacup will be available at a particular time. We cannot assure you that we will always maintain a backup for an account.

Todhost backups are provided as a courtesy and are not guaranteed. Customers are responsible for their own backups and web content and should make their own backups for extra protection. For additional information, please refer to our Terms of Service.

Your cPanel or VPS container can be restored by Todhost after you submit a restoration request form.

Shared and Reseller Plans

Todhost may create weekly backups of shared servers for accounts that are under 5GB GB. For Reseller plans, these limits apply to each cPanel individually.

VPS Hosting Plans

We create weekly backups of VPS containers, which include everything on your VPS at the time of backup.

Linux Dedicated Servers

By default, new servers are set up with RAID 1 which mirrors data on two hard drives; however, this is not a solution for backups. Although Todhost does not make backups of Dedicated servers, there are many options available for making your own backups.

If you would like your server set up differently, or if you would like something other than RAID 1, please contact us via phone or Live Chat and we can assist you in setting up an appropriate solution.

Todhost does not create backups for dedicated servers. For information regarding how you may create full server backups on dedicated servers please reference the following article:

What If my account was suspended?

If your account is suspended less than one week before we run backups, your account will still be backed up.

If you have been suspended for more than a week when we run backups, your old backup will be erased and your account will not be included in the new backups. We will thus have no backups for your account.

Get started with our shared web hosting services: Order Web Hosting with Todhost

  • 48 Users Found This Useful
Was this answer helpful?

Related Articles

I have a full backup of account through cPanel. How do I restore it?

It is recommended that you maintain healthy backup of your website and possibly download the...

How To Create, Edit, and Delete a File in cPanel Using File Manager

This tutorial will be useful for you to understand how to create a file, edit a file or delete...

How to Create and Manage a MySQL Database

Create MySQL Database and User via cPanel The MySQL Database Wizard is another useful tool...

How do I create and remove an Addon Domain?

An add-on domain is a separate domain name that you add to your web hosting subscription with...

How to Set Up and Delete a Cron Job

A cron job allows you to run a certain command at times set by the job. For example, you could...