Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

Beginner’s Guide: How to Restore WordPress from Backup

Last updated on by
Follow WPBeginner on YouTube
Beginner’s Guide: How to Restore WordPress from Backup

Even on the Internet, bad things can happen to good people. This is why we keep reminding you to back up your websites. We have written about different methods to backup WordPress such as: manual backup, BackupBuddy, BackWPup, and VaultPress. Now that you have a WordPress backup, you need to know how to use it in case of emergencies. In this guide, we will show you step by step guide on how to restore WordPress from backup. You will need to restore WordPress in case a disaster strikes your website such as getting hacked or infected by malware, loss of data, cancellation of services by web host, etc.

Note: This guide is for restoring WordPress from backup. If you are trying to move your WordPress website to a new domain, then you should check out our guide on moving WordPress to a new domain without losing SEO. If you are trying to move from local host to a live web hosting account, then follow this guide on how to move WordPress from local server to live site.

Understanding Backups and Restoring WordPress

There are different ways to create backups. You can use plugins to create database backups or full site backups. You can also create manual backups. Restoring WordPress from those backups depends on how you created them. For example backups created using BakupBuddy can be restored by using the same plugin. Manual backups need to be manually restored. A lot of WordPress users don’t backup their entire websites, instead they only back up their theme, uploads directory, and their WordPress database. This reduces their backup size, but increases the steps needed to restore the site.

No matter how created your back up, the basic steps are the same. First you need to clean your WordPress files. The best way to do this is delete everything from your web server using an FTP client. Next, you need to restore the database, install fresh copy of WordPress and the plugins you had, then lastly restore your theme and images.

Restoring WordPress from BackupBuddy Backup File

BackupBuddy offers a very convenient way to restore WordPress from a backup. If you are using BackupBuddy to backup your website then login to your WordPress website and go to BackupBuddy » Restore/Migrate. Download a copy of importbuddy.php. You will be asked to provide a password for importbuddy. This password will be used when you restore your website.

Download a copy of your backup. You can download it from BackupBuddy » Backups or the destination that you used to store your backups.

Once you have the backup zip file and importbuddy.php stored on your computer, connect to your website using FTP. If you have a complete backup of your website, then delete all files and folders from your server. However, if you have a partial backup then you may want to first download the files that you haven’t backed up. For example, files in your /wp-content/uploads and /wp-content/themes directory. Once you are sure that you have everything backed up, proceed deleting all files and folder from your website’s root directory.

Upload your BackupBuddy backup and importbuddy.php files. Once both files are uploaded to the server, visit importbuddy.php in your web browser. It is in your website’s root directory so its URL will be something like:

http://www.example.com/importbuddy.php

ImportBuddy will now ask for the password that you created when you downloaded ImportBuddy.

Provide importbuddy password to start restoring

On the next screen, ImportBuddy will display the backup file you uploaded. In case you did not upload your backup file using FTP, then you can click on upload tab to upload the backup file now. If you have your backups stored on iTheme’s Stash storage service, then you can connect to it by clicking on stash tab now. Once you have selected your database, click on Next Step to continue.

Select the backup file to restore

ImportBuddy will unzip your backup file and show you a success message when it has extracted the files. Click on the next step button to continue. On the next screen, ImportBuddy will ask you to provide site URL and Database information. If you are moving from one domain to another, or a local server site to a live site, then you will need to update the site URL. If you are simply restoring a WordPress site then it will already be set to use your current URL.

Provide site URL and Database information

If you are restoring a hacked WordPress website or trying to remove malware, then you do not want to use your old database if it already has WordPress installed. You can either drop tables from your old database using phpMyAdmin, or create a new database using cPanel. Once you are done creating a new database or emptying the old one, provide your database details. If you are restoring to your old database then Import Buddy may have already filled these fields for you. Test your database settings and then click on next step to continue.

ImportBuddy will now import your database once it is done, click next step to continue. Now ImportBuddy will update your site URLs paths etc. Once it is done, you will be asked to test your site. If everything is working fine, then you have successfully restored your website. On the importbuddy page click Clean up and remove temporary files button. This will delete temporary data in database and files created during restoration.

Restoring WordPress Database from Backup using phpMyAdmin

When restoring a manually created backup, you may come across two possible choices. You can either create a new database and import your backup into it, or you can empty your existing database and import backup. If you are cleaning a hacked WordPress website, then it is very important to change your MySQL username and password before creating a new database or importing into existing database.

To empty your existing database, log in to your cPanel account (Your web host may have some other solution), scroll down to databases section and then click on phpMyAdmin. This will open phpMyAdmin in a new browser tab. Click on your database, and select all tables. From the drop down to your right, click drop selected tables, as shown in the image below:

Emptying an existing WordPress Database

Now if you were creating a new database, then simply log in to your cPanel account. Scroll down to the databases section and then click on MySQL databases.

Creating a database using cPanel

On the next screen simply provide a name for your new database and hit create database button.

Create new database

Once you have a clean database OR a new database, click on the import tab on the top in phpMyAdmin. This will take you to the import page where you can click on choose file and the select the database backup from your hard disk. . After choosing your back up file, click on the Go button at the bottom of the page. phpMyAdmin will now import your database.

Restoring WordPress Database Backup using cPanel

If you manually created a WordPress database backup using cPanel, then you can also restore that database using cPanel. Log into your cPanel account and scroll down to files section and click on Backups.

Restoring backup in cPanel

On the backups page scroll down to Restore a MySQL database backup. Click on choose file and select the backup file from your hard disk. Once done, click on the upload button.

Restoring MySQL database backup in cPanel

Manually Restoring WordPress Files using FTP

If you are restoring a WordPress website to clean up a hacked site or to remove malicious code, then you should know that it would work best if you delete every thing on your website first. Delete all WordPress core files and directories. Only do this if your backup is up to date, and has everything you have customized, changed, or uploaded on your website. If you do, then you can delete every thing on your website using cpanel (way faster), or using FTP.

To delete all files from your website using cPanel, log in to your cPanel dashboard and scroll down to Files section. Click on File Manager, which will then ask you for directory selection. Choose Web root and proceed. File manager interface will now open in a new tab in your browser. Select all WordPress files and delete them.

cPanel File Manager

To delete files using FTP, simply connect to your website using an FTP client such as FileZilla. Select all files in your WordPress root directory and delete them.

Deleting files using FTP

Now before you start uploading files from your backup, make sure that the back up you have is clean. If you are restoring a website that had malware or was hacked, then you need to make sure that no exploited file or backdoor is present in your backup files. This is why we would recommend that you only upload your images and theme from your backup.

Download a fresh copy of WordPress from WordPress.org and extract it to your hard disk. Open the local directory in FTP, select all files, and upload them to your website.

Uploading a fresh copy of WordPress using FTP

Once you have uploaded WordPress files, you can upload your wp-config.php file from your backup (if you are sure that it is clean and not compromised). Alternately, you can rename wp-config-sample.php file in your freshly uploaded WordPress files to wp-config.php file. Right click and edit wp-config.php file. Provide your host, database name, database username and password information (you can find this in your old wp-config.php file). If you changed your MySQL user’s password then use new password here. Save the file and upload it back to your website.

Now you need to upload other files from your backup. We will recommend that you only upload your images in /wp-content/uploads/ directory and your WordPress theme. Once you have uploaded these, visit your website to check that every thing is working fine. Also log in to your WordPress admin area.

So far we have restored database and files. Now you need to download fresh copies of the plugins you had on your site. Simply install and activate them one of by one. Lastly, go to Settings » Permalinks and adjust permalinks settings to your old site and then update permalinks.

Troubleshooting WordPress Backup Restore Issues

There are some common problems that you may come across when restoring your WordPress website. We have separate guides for each of them.

Things to do After Restoring your WordPress Site

Once you have successfully restored your website, you need to make it secure. First create a backup and schedule regular automated backups. For securing your website, we will recommend that you immediately change your WordPress password. If you are running a multi-user website then ask all users to update their passwords immediately. Secure your WordPress by making your admin area password protected. Enable Google 2-step authentication to add an extra layer of login seurity for your site. At WPBeginner we use Sucuri to monitor and strengthen security of our website. It monitors for security threats, and they also offer malware removal service with their subscription plans. Here are 5 reasons why we use Sucuri.

We hope this guide helped you restore WordPress from backup. If you run into a problem or have feedback for us, then please leave a comment below.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • http://www.wpbeginner.com/ WPBeginner Staff

    Simply click on Appearance » Themes and click on the activate button on the theme that you had previously installed. In case you can’t figure out which theme you had previously installed, then you will need to activate them one by one and preview your website until you get the right theme.

  • Dill

    Hi… I was wondering how to restore my wordpress site if all I have is a complete download of everything that was there. I downloaded everything (everything!) from my host using FTP and didn’t do any fancy backups of databases. Can I just upload that entire backup as is and get the site back? I’m also switching hosts (but not domain names), so I do know I’ll have to edit a file or two also.

    • http://www.wpbeginner.com/ WPBeginner Support

      If you only copied everything from FTP then you probably only have your WordPress files and not the database. Without the database backup you can not restore your site. If you have access to your host, then please create your database backup.

  • Kyle

    Hi,
    Thanks for all your tutorials, I find myself here often. I had a question, is there any way to retrieve the subscribers from a backed up .sql file? The plugin used to collect subscriptions was Subscriber 2.

  • Bruno

    Your site is great. Can you write a guide how to restore a backup created with BackWPup? That would be great.

    • http://www.wpbeginner.com/ WPBeginner Support

      Sure we will try to do that. Meanwhile, here is how to restore your backup created with BackWPUp plugin. Download your backup file and extract it. Inside it your will find a .sql file along with other files. .SQL file is your database backup and you can import it using phpMyAdmin. Upload rest of the files using FTP.

  • tuyen ran

    how to show my password on file database backup from backupbuddy? It is encryption!. thanks you!

  • Raji

    This post is extremely helpful as it has helped me (a newbie) to restore my site….or almost. When i try to login, it takes me to a page that says i should install wordpress again…. the famous 5minutes install. please help.

    • http://www.wpbeginner.com/ WPBeginner Support

      It seems WordPress is unable to connect to the database. Or it connected to the database which is currently empty. You have restored your WordPress files but you probably didn’t restore your WordPress database backup successfully.

  • Md Jafrul Islam

    Thank you very very much. By this info post detail. I can make my site again restore. Thanks Man. Just awesome update more amazing info.

  • Chris

    When doing a backup, which backup do I need most frequently? I am offered three choices on the cPanel (full cPanel backup, home directory, database). Would you say it is more important to backup the database file, as long as I have a fairly recent backup of the home directory?

    Thanks for your time!

    • http://www.wpbeginner.com/ WPBeginner Support

      Depends on how often your site gets updates like comments, posts, media uploads, we would say that you should always set a high priority for database backups

  • Bas

    Thanks for the great guide(s). I had to move 2 sites from 1 server to a new server, and using your manuals it went like clockwork.

    Making the backup via BackWPup was quick and restoring it manually the same.

    I was up and running again in 15 minutes.

    BTW. The version of BackWPup I use (3.0.13) only showed the Dropbox feature after creating, saving and running the backup job.
    I had to change something, when the sites where moved, and there it was.

  • Naik

    Hi,
    I recently shifted my blog from one hosting to another in Godaddy. I have the backup of my blog in .sql format. I am trying to import using MySQL, it shows an error “Script timeout passed, if you want to finish import, please resubmit same file and import will resume.” Please help

    • http://www.wpbeginner.com/ WPBeginner Support

      Did you try resubmitting the same file again to resume import?

  • Brenda

    I have been able to follow the instructions above for restoring my wordpress database using cpanel by dropping the tables in the current database and replacing them with the backedup database.

    However I can’t work out how to do it if I create a new database – the article says to go into mysql within cpanel and set up a new database, password etc but how do I link the new database to the files that I have reinstalled?

    Thank you

    • http://www.wpbeginner.com/ WPBeginner Support

      Brenda, connect to your website using an FTP client like filezilla, download wp-config.php file from your website’s root directory create a backup of it by simply making a copy of it. Open it in a text editor like notepad. and enter your database name, database user name, database password, and host (usually localhost). Save the file and upload it back to your website.

      • Brenda

        Thanks. I have done that but when I try to access the site I get “Error establishing a database connection”

        I did what you said and replaced the original wp-config file with the new version.

        What else do I need to do to be able to use the new version of the database, rather than the original one?

        • Brenda

          Sorry, some more information that might clarify what is happening. When I try, as suggested in your article, to access the wp-admin url I get an error message that starts with the following:

          We were able to connect to the database server (which means your username and password is okay) but not able to select the NAME database.

        • Brenda

          Sorry, some more information that might clarify what is happening. When I try, as suggested in your article, to access the wp-admin url I get an error message that starts with the following:

          We were able to connect to the database server (which means your username and password is okay) but not able to select the NAME database.

          At the bottom it says: On some systems the name of your database is prefixed with your username, so it would be like username_webgyzec_replacewp1. Could that be the problem?

          That is indeed the case. So what do I need to change please to get this to work?

        • Brenda

          OK I can stop sending messages now. Silly error on my part but now everything is working.

          Thank you SO much for such a helpful article.

  • Henry

    Thanks for sharing.

  • John

    Thanks so much.

    • http://www.wpbeginner.com Editorial Staff

      You are welcome John.

  • Abhisek

    Thanks for this very informative post. I was wondering how you could trim your breadcrumbs. I wish if you could help me with that for my blog TechniKaly.

    • http://www.wpbeginner.com Editorial Staff

      We use a plugin called BreadCrumb NavXT

  • Jotpreet

    Nice read. Hope you’ll give a little bit more cody part in the post. But until then,
    Cheers !

  • Mustafa

    Hi,
    i am new in yours’ website. Actually my first impression about your site is fantastic. Thanks for all of the tutorials. This tutorial is also great. Thanks again…