Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Restore a WordPress Site with Just a Database Backup

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

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.

Recovering a WordPress site from a database backup alone

Getting Started

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.

Also see: 7 Key Indicators when you should switch your WordPress hosting.

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.

MySQL databases in cPanel

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

Creating new MySQL database

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.

Adding a new MySQL 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.

Adding a user to database

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.

Launching phpMyAdmin from cPanel

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.

importdb

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.

Creating configuration file step during WordPress installation

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.

Already installed message

That’s all you can now proceed to login to your WordPress site.

Restoration Troubleshooting

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.

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 theme options to set it up the way it was before.

2. Widgets

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.

3. Permalinks

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.

4. Plugins

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.

Deactivated plugins

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.

Finding cached images in Firefox

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.

Finding your images in Google Image search

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.

Internet Archive Way Back Machine

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.

Find and replace missing images in WordPress

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.

Bonus Tip

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.

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

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

22 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Moinuddin Waheed says

    Thanks for this guide.
    I have a backup from 2016 of one of my blogs and I have tried multiple times not able to restore them back.
    I will try these steps and see if I would be able to successfully restore my database.
    the thing that I am missing are the posts that I had written on my blog.
    hope this will work.

  3. Ruby Yeo says

    Hi, please help, the ‘create a configuration file’ part didn’t pop up after successful installation :(

  4. Mallory says

    Thanks for this article! I restored my site from the database file. But when I visited the plugins page for the first time, I didn’t immediately copy the list of plugin errors from the plugin files that don’t exist any more. Now the notification is gone. Is there any way to find this list again? There were several plugins that I don’t remember but need to be reinstalled.

    • WPBeginner Support says

      Sadly, we do not have a specific location we would recommend for finding the errors again.

      Admin

  5. Emmanuelkwofie says

    Hi, I was noticed by my hosting company that hackers have back door to my website so I should clean it and didn’t know what to do, so I did a backup of my theme, plugins, and upload and downloaded it to my local pc. I did not also remove the database. so in all, I have my database and the other files I backed up. Please, can I still get my website back and how? i don’t have the htc.access file and the wp.config file. How do i get my website back as it was?

  6. Dean says

    I ran restore database and let it run for HOURS. All the time it said “loading”. When I went back into cPanel the dbase size is 0.00.

    Is there some voodoo magic I can use to restore my database?

    • WPBeginner Support says

      You would want to first reach out to your hosting provider to see if they’re having any issues on their end that could be preventing the restore.

      Admin

  7. eswaran says

    i have installed wordpress on server and took backup using this i have created same copy of wordpress in my local machine. I have installed some of plugin on server and restored the plugin physical file via FTP to my locai machine. Then i took DB backup from server and restored in my local machine.

    The problem is i have activated the plugin’s on server but after restore database the plugin not active automatically in my locai machine. Every time i need to activate manually.

    To achieve this do i need update any sql script on database?

  8. Lisander says

    I have an old site I wanted to recover, but my old laptop crashed.
    Had an older back up lying around (not the latest). i followed these steps, now I have about 70% restored.

    Thanks for the guide.

  9. Mustapha says

    Thank you very much,
    Restored 90% of my lost template, I worked hard for 2 months to create it.
    Many thanx!

  10. zhul says

    so what happen with my old article if i restored the new backup from another site?
    is it replace all data?

  11. Ahmed LAHMAR says

    Thank you WPBeginner,
    I went through the same bad experience but luckily my images were stored in the free cdn offered by WordPress.com

  12. Ewan Yates says

    Thanks for this great guide. Quick question though,…
    When creating a new database and user, do they need to be the same as the ones in the backup?

  13. Dusty says

    This is a great guide for those instances where a full backup isn’t available. Full backups are so important! Thanks!

Leave a Reply to Ewan Yates Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.