We always recommend our users to make complete WordPress backups on a regular basis. But what if you unknowingly used one of the free plugins that only make database backups? In this article, we will show you how to restore a WordPress site with just a database backup. It will not be a complete restore, but we will show you how you can minimize the damage.
For the sake of this tutorial, we are assuming that you have your WordPress database backup in a zip file. If you do not have one yet, here is how to make a WordPress database backup manually.
If you are recovering from a bad experience with your web hosting provider, then it is probably the time to find a better host. We have hand picked some of the best WordPress hosting providers. These are the companies that we have worked with and trust with our own projects.
Preparing to Restore WordPress Database Backup
First, you will need to create a new database. Simply login to your cPanel account and click on MySQL Databases under the Database section.
Next, provide a name for your database and then click on create database button.
Now that you have created a database, you need a MySQL user who will be assigned all privileges to work on your newly created database.
On the same MySQL databases page, scroll down to MySQL users section and add a new user.
Provide a username and a strong password for your database user and then click on create user button.
Next, you need to add this user to the MySQL database. Scroll down to ‘Add user to database’ section and select the user along with the database from the drop down menus and then click on the add button.
Your new database is now ready for WordPress.
Importing WordPress Database Backup
First you need to visit the cPanel dashbaord. Under the databases section, you need to click on phpMyAdmin.
On then next step, select the database you created earlier on the phpMyAdmin page and then click on the Import button.
Now you need to click on the choose file button to upload your WordPress database backup file. Simply click on the go button at the bottom of the page to start importing.
You will see a success message when the import job is finished.
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 restore of WordPress, you will need to manually install WordPress on your server. Visit our step by step WordPress installation tutorial and jump to the section ‘how to install WordPress using FTP’ for detailed instructions.
During the installation, when you reach ‘create a configuration file’ step. Enter the database name and user you created earlier.
You will now see a message that WordPress can connect to your database, and you can run the installation now.
Clicking on the install button will now show you the ‘Already Installed’ message.
That’s all you can now proceed to login to your WordPress site.
Since you do not have your old WordPress files, there will be several things missing. Some of them can be easily restored while others will be a bit difficult. We will go through all of them one by one.
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 theme options to set it up the way it was before.
Widgets play an important role in WordPress themes. Luckily, 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. In order to use those widgets, you will first need to install and activate those plugins.
Your site’s permalink structure is also stored in database, and it will be automatically restored. However, if you are seeing 404 errors on front-end of your site, then you need to refresh permalink settings.
Simply go to Settings » Permalinks and click on the save changes button without changing anything. This will refresh your WordPress url structure.
WordPress stores a record of your site’s active plugins. 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 not installed anymore.
Copy all the plugin names and start installing and activating them one by one.
Recovering Lost Images for your WordPress Site
Finding and replacing lost images on your website would be the trickiest part of the 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 images are fairly low.
1. Look in Your Browser Caches
If you have recently lost your website, then you can look into your browser cache.
Firefox users can download CacheViewer2 add-on to easily find images from their website stored in browser cache.
You can 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 will be out of luck. We were unable to find any reasonable solution to browse, preview, and save image from Google Chrome cache on Mac.
2. Look for Your Images in Web Caches
There are several web services that keep cached versions of websites. You can start by looking for your images in Google’s image search. Simply enter your site’s URL and you will be able to see images Google found on your website.
You can click on an image to see a larger preview and save the image.
If you are restoring a much older site and can’t find images on Google or Bing, then you can try Archive.org. It is a non-profit organization that stores snapshots of websites for historical purposes.
Finding and Replacing Images on Your Website
If you did not have much content on your old site, then you can manually replace images in your posts. However, if you have a lot of content then finding and replacing images manually will be difficult.
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 Links Checker page. The plugin will show you a list of all broken links on your site.
Broken images are also considered broken links, so they will appear in the list as well. You can click on the link text column to sort the broken links list to show images first.
Now you can replace the images that you have recovered by editing posts. For the images that you were not able to recover, you can either try to recreate them or simply unlink them.
It will be hard to recover all your lost data. Your site may even show errors and affect user experience. This is why you see many experts strongly 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 on the cloud.
That’s all, we hope this article helped you restore your WordPress site from database backup. You may also want to see our list of 13 vital tips and hacks to protect your WordPress admin area.