Family Best Time >> Electronics

How to restore a WordPress site with only a database backup

We always recommend our users to take full WordPress backups regularly. But what if you unknowingly used one of the free plugins that only do database backups? In this article, we will show you how to restore a WordPress site with just a database backup. It won't be a full restore, but we'll show you how you can minimize the damage.

How to restore a WordPress site with only a database backup

Getting started

For the sake of this tutorial, we assume that you have your WordPress database backup in a zip file. If you don't already have one, here's how to manually backup your WordPress database.

If you're recovering from a bad experience with your web host, then it's probably time to find a better host. We have selected some of the best WordPress hosting providers. These are the companies with which we have worked and trust in our own projects..

Also see:7 Key Indicators When You Should Change Your WordPress Hosting.

Preparing to restore the WordPress database backup

First, you will need to create a new database. Simply log in to your cPanel account and click on MySQL Databases in the Database section.

How to restore a WordPress site with only a database backup

Next, provide a name for your database and then click the create database button.

How to restore a WordPress site with only a database backup

Now that you have created a database, you need a MySQL user who will be assigned full privileges to work on your newly created database.

On the same MySQL databases page, scroll down to the MySQL users section and add a new user.

How to restore a WordPress site with only a database backup

Provide a username and strong password for your database user and then click the create user button.

Next, you need to add this user to the MySQL database. Scroll down to the 'Add User to Database' section and select the user along with the database from the dropdown menus and then click the Add button.

How to restore a WordPress site with only a database backup

Your new database is now ready for WordPress.

Import WordPress Database Backup

First you need to visit the cPanel control panel. Under the database section, you need to click on phpMyAdmin.

How to restore a WordPress site with only a database backup

In the next step, select the database you created earlier on the phpMyAdmin page and then click the Import button.

Now you need to click the choose file button to upload your WordPress database backup file. Just click the Go button at the bottom of the page to start importing.

How to restore a WordPress site with only a database backup

You will see a success message when the import job completes.

You have successfully imported your WordPress database. Now the next step is to install WordPress using your new database.

Restoring your WordPress site

For a manual WordPress restore, you will need to manually install WordPress on your server. Visit our step-by-step WordPress installation tutorial and go to the 'How to install WordPress using FTP' section for detailed instructions.

During installation, when you get to the 'create a configuration file' step. Enter the database name and user you created earlier.

How to restore a WordPress site with only a database backup

You will now see a message that WordPress can connect to your database, and you can run the installation now.

Clicking the install button will now bring up the 'Already installed' message.

How to restore a WordPress site with only a database backup

That's all you can do to login to your WordPress site.

Restore Troubleshooting

Since you don't have your old WordPress files, several things will be missing. Some of them can be easily restored, while others will be a bit difficult. Let's go through all of them one by one.

1. theme

Simply install a fresh copy of your old WordPress theme. If you made direct changes to your theme files, then all those changes will be gone.

You will have to go through the theme options to set it up as it was before.

2. Widgets

Widgets play an important role in WordPress themes. Fortunately, they are stored in your WordPress database and switching to your old theme will restore some of your widgets.

You can always go to Appearance »Widgets to add and rearrange widgets in your sidebars.

Some WordPress plugins come with their own widgets. To use those widgets, you will need to install and activate those plugins first.

3. Permalinks

Your site's permalink structure is also stored in the database, and will be restored automatically. However, if you are seeing 404 errors on the front end of your site, then you need to update your permalink settings.

Simply go to Settings »Permalinks and click the Save Changes button without changing anything. This will update your WordPress url structure.

4. Accessories

WordPress stores a record of the active plugins on your site. When you visit the plugins page for the first time, WordPress will show you a list of errors for each plugin that was in the database but is no longer installed.

How to restore a WordPress site with only a database backup

Copy all the plugin names and start installing and activating them one by one.

Recover lost images for your WordPress site

Finding and replacing the missing images on your website would be the hardest part of recovery. Depending on how much content and images you have, this can take a long time.

Unfortunately, there is no easy way around it. You will have to use a variety of tools to extract your images from different sources. Your chances of recovering all the images are quite low.

1. Look in your browser for caches

If you have recently lost your website, you can search your browser's cache.

Firefox users can download the CacheViewer2 plugin to easily find your website's images stored in the browser's cache.

How to restore a WordPress site with only a database backup

Just right click on an image and select Save As from the menu.

Google Chrome users on Windows can try Chrome Cache Viewer.

Google Chrome users on Mac are out of luck. We couldn't find any reasonable solution to browse, preview and save images from Google Chrome cache on Mac.

2. Search your images in web caches

There are several web services that maintain cached versions of websites. You can start by searching for your images on Google image search. Simply enter your site URL and you will be able to see the Google images found on your website.

How to restore a WordPress site with only a database backup

You can click on an image to see a larger preview and save the image.

If you're restoring a much older site and can't find images on Google or Bing, you can try Archive.org. It is a non-profit organization that stores snapshots of websites for historical purposes.

How to restore a WordPress site with only a database backup

Find and replace images on your website

If you didn't have much content on your old site, then you can manually replace the images in your posts. However, if you have a lot of content, it will be difficult to find and replace images manually.

Here is how you can easily locate broken images and replace them.

First, you need to install and activate the Broken Link Checker plugin. Upon activation, simply go to Tools »Broken Link Checker page. The plugin will show you a list of all broken links on your site.

How to restore a WordPress site with only a database backup

Broken images are also considered broken links, so they will also appear in the list. You can click the link text column to sort the list of broken links to display images first.

Now you can replace the images you have retrieved by editing posts. For the images that you couldn't recover, you can try to recreate them or just unlink them.

Bonus Tip

It will be difficult to recover all your lost data. Your site may even show errors and affect the user experience. This is why you see many experts urging you to set up automatic backups.

We recommend using BackupBuddy. It is a premium WordPress backup plugin with easy restore options and the ability to automatically create and save your backups to the cloud.

That's it, we hope this article helped you to restore your WordPress site from database backup. You may also want to see our list of 13 vital tips and tricks to protect your WordPress admin area.

If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.