How to Make a WordPress Database Backup (and Restore)

How to Make a WordPress Database Backup (and Restore)

Taking regular database backups of your WordPress site is critical. The database contains the "kernel" of your site with all its content, categories, tags, and plugin settings. While the theme is responsible for the style, the database is responsible for the actual content. Everything is driven from it. If you want to migrate your site to another server for example, it is the database that's the most crucial aspect.

Databases can also get corrupted now and then, which is why it's important to always have a reliable backup for your site so that you can restore it at any moment. In this article, I'll show you two broad approaches to WordPress database backup and restore procedures

WordPress Database Backup via cPanel

If you're lucky enough to have hosting that includes automatic database backups of your entire site, then this is the easiest option to go with. This solution won't affect your site performance, restoration is easy, and you will have a nice convenient graphical representation of the various backups available and you just need to click on one button to restore. For example, take the pro hosting plans of Siteground. If I go to the cPanel homepage, I see the following section:

Once inside, I get to see all the various backups that Siteground has taken of my site over the past several days:

So I simply select the day I want (in this case the latest), and choose what I want to restore:

In this case, I want to restore the database, and not the files. Then I choose which database I want to restore (since I have more than one):

I've blacked out the database names for privacy. But I can just tick the checkboxes, hit "Restore", and my database will be restored to what it was on that given day. Easy!

But what if you're not lucky enough to have your hosting provider do everything for you? What if we need a solution that works regardless of the hosting plan? In such a situation, we can rely on a plugin for regular backups.

Using a Plugin for Database Backups

For our purposes, we'll be using the open source WP-DB-Backup plugin which is recommended by WordPress itself. It's easy to use and configure. After installation, we can find the settings in the "Tools" menu of the WordPress dashboard:

wordpress database backup plugin

The first few sections are for immediate, manual backups. Here, all the core WordPress tables are automatically selected. The other ones are related to plugins, and a bunch of other things like whitelists and comment logs. By default, the non-critical tables are deselected in order to reduce the size of the final backup:

how to backup wordpress database

Once you have the tables you want, you can scroll down to choose how the backup will be delivered to you - via immediate download, or by e-mail:

When you click "Backup now!", the backup process starts immediately. Don't disturb anything till the progress is complete:

wordpress backup database

Once it's done, the file will either be e-mailed to you, or downloaded immediately depending on the choice you made.

Scheduling Backups:

The real value of the plugin however, lies it its ability to schedule regular backups so you don't have to manually remember. Scrolling down, you can choose the frequency as well as the e-mail ID to which it will be delivered. As before, you can also choose the tables:

backup wordpress database

Based on the schedule you choose, the backups will be e-mailed to you andĀ also stored in a separate backup folder located in the "wp-content" directory of your WordPress installation. This is great, because it's a nice repository for database backups that are always accessible via FTP.

Restoring the Backups

The easiest way to restore the backups you get from WP-DB-Backup is by using the phpMyAdmin utility found in every cPanel hosting. Once you're inside, and have selected the database you want to restore, click the "Import" tab and select the backup file as shown here:

backup wordpress database phpmyadmin

This will import the backup file into your existing database and restore it. It's that simple.

Having a regular database backup plan is critical for your site, since sooner or later somethingĀ will go wrong. It's not enough to wait for an emergency before trying to figure out how to fix it. The key is being proactive, so you won't have a heart attack someday in the near future!

Is Your Website Slow?

A slow website can cost you visitors. Enter your website URL below to test its load speed now and find out how to make it faster:

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclosure: We receive a compensation from some of the companies whose products are presented on our website.