Articles, WordPress

How to Backup a MySQL Database

How to Backup a MySQL Database

Backing up your website is essential as a developer, website owner or someone who runs a business online. Getting into the habit of backing up your website is an important practice everyone should adopt.

In this article, we’re going to show you how to backup your website’s MySQL database. This is just half of the process for backing up your website. The other half would entail backing up your website’s files, but we’re going to stay focused on how to properly backup your database in the steps below. It is highly recommended (and best practice) that you backup anything relating to your website before making any changes–whether that’s updating plugins or extensions, changing your theme, or having a developer make changes or create additional functionality.

Without proper backups of your website’s files and database, should your web hosting provider experience any issues, the consequences can be significant leaving you and your business helpless since you’ll be dependent on them to get your website back online. As a courtesy, most web hosts generate backups of your account, but it’s always best practice to generate your own backups and store them to an offsite location whether that be locally or to a third-party service to be safe. Often times it’s a task that website owners overlook, but can save you a headache and frustrations down the road.

  1. How to Backup a MySQL Database in cPanel
  2. How to Backup a MySQL Database in phpMyAdmin
  3. How to Backup a WordPress Database
  4. How to Backup a WordPress Database with UpdraftPlus

1. How to Backup a MySQL Database in cPanel

Most web hosting providers will give you access to cPanel (with exception to a few who use their own proprietary control panel). Inside of cPanel you’ll have access to your website’s files, databases, and other settings you can configure on your hosting account.

Inside of cPanel you should see a Backup icon under the FILES heading.

Clicking the Backup icon will load a page that presents you with a few options; Full Backup or Partial Backups of your website’s files or website’s database.

Under the Download a MySQL Database Backup you will see a list of the MySQL databases on your account. Click the database you want to backup. This will open a popup prompting you to save the database (.sql file) to your computer.

If you have a large database please be patient. It may take a longer amount of time for the dialog to appear asking you to save the .sql file.

2. How to Backup a MySQL Database in phpMyAdmin

Assuming you have access to cPanel you’ll want to look for an icon for phpMyAdmin. If you don’t have access to cPanel you’ll want to 1) ask your hosting provider how you can access or backup your database or 2) ask your hosting provider how you can access phpMyAdmin if available through their services.

Once you’re logged into cPanel, locate the phpMyAdmin icon under the DATABASES heading.

This will open a new window in your browser that will open phpMyAdmin and look something like the below image. Your website(s) database(s) will be located in the left column with a + symbol next to it. Clicking the + symbol will expand the view and display the database tables.

Click your database. This will highlight your database and database tables. After selecting your database, click the Export button at the top and the Go button on the next page.

After clicking the Go button, a popup dialog will appear. This will prompt you to download your database (.sql file) to your computer. Save this .sql file to a safe location. This is the file of your database that contains your database tables. Once you have saved this file you have successfully save your MySQL database inside of cPanel while using phpMyAdmin.

3. How to Backup a WordPress Database

For WordPress users you can backup your WordPress database using either of the first two methods above. You can also backup a database for your WordPress site(s) using a backup plugin. There are many backup plugins available in the WordPress marketplace so you’ll want to do some research before choosing one to use.

Some WordPress backup plugins will backup your entire site, files and database, and store it on your hosting account. Some plugins will require you to connect the plugin to a third-party location so your backups are stored off-site (Recommended). The later option is recommended since you won’t have access to those backups if your server goes offline.

4. How to Backup a WordPress Database with UpdraftPlus

UpdraftPlus has been around for many years. The plugin has simplified the backup process so you just have to choose what to backup–the website files, database or both while managing everything all within the WordPress dashboard.

Access your WordPress dashboard and navigate to the Plugins section. Click the Add New button and search for UpdraftPlus in the Search plugins… field box located in the upper right of the page.

After you have successfully installed and activated the UpdraftPlus plugin navigate to Settings > UpdraftPlus Backups. Click the Backup Now button to begin the backup process.

A popup will appear asking you to include the database in the backup and to include any files in the backup. If you’re looking to update just the database make sure to have the box CHECKED for Include the database in the backup.

When the backup process is completed a popup will appear showing a green checkmark with a message The backup has finished running.

Now you’ll see the backed up database under the Existing Backups section in the Updraft Backups page like below:

We would recommend downloading the database so you have a local copy of the database (just in case you need it). UpdraftPlus has great functionality built in so you can Delete the database and Restore the database directly through the WordPress dashboard.

Now you’ve successfully managed to backup your MySQL database using different methods. If you have any questions regarding any of the processes outlined above don’t hesitate to reach out to support and a member of our team would be happy to help.

Previous ArticleNext Article