Probably, you’ve already learned how to backup a WordPress website. And today, wondering how you could actually restore your website in case something went wrong.
Maybe your WordPress website gets hacked by a malicious individual, or in some instance, it just stops working properly.
Restoring WordPress from a backup file is not easy for most WordPress users – especially beginners. And recently, one of the WPMakeSite readers ask me exactly how to restore site from backup as you can see below.
In this guide, I will walk you through how you could easily restore WordPress site from backup step by step.
Things You’ll Learn From This WordPress Restore Guide
- Understand how WordPress backup works and ways to restore them
- How to restore WordPress database backup using phpMyAdmin
- How to manually restore WordPress files using FTP
Please note that in order to restore WordPress you must have a backup which includes all the elements that make up your site (WordPress core, database, theme & plugins, and more).
How WordPress Backup and Restore Works?
Backing up WordPress site comes in different ways and probably, one of the best ways is using a WordPress backup plugin.
Most WordPress experts recommend using BackupBuddy, a comprehensive WordPress backup plugin that allows you to perform automatic WordPress backups and the ability to seamlessly restore WordPress.
Additionally, you can also create WordPress database backup manually using phpMyAdmin and download your WordPress files using an FTP client.
Thus, restoring WordPress site from backups depends on how you’ve created the backup. And if you’ve used BackupBuddy to backup WordPress, restoring it is pretty straight forward.
Likewise, if you’ve done manual sort of backing up WordPress, you also need to manually restore it.
In my case, I usually don’t backup the entire site. Instead, I prioritize the most important one and just leave the rest. I only backup wp-contents folder which includes theme, plugins, and uploads directory, WordPress database, and wp-config.php file. This allows me to save disk space and time and reduce the size of backups.
Take note that this would require downloading a fresh copy of WordPress by the time you need to restore WordPress. It’s much safer especially when your site gets hacked.
Manually Restore WordPress Database Backup Using phpMyAdmin
Normally, if you are just trying to restore your site from an older version since the newer one stops working then you can just empty the existing database and import your backup.
However, in some cases wherein your WordPress website been hacked and gets compromised and want to clean it, then it is very important to change your MySQL username and password before creating a new database or importing backup into the existing database.
To do this, first thing you need to do is login to your WordPress hosting Cpanel.
Alright, now click on the MySQL Databases icon under Database Tools.
In the next window, give your database a name (yournewwpdb) as an example, and then click on the Create Database button.
The system will create MYSQL database. You should see the database “x2demo1_yournewwpdb” has been added. Click on Go Back button to return.
Next, you need a MySQL user to be associated with the newly created database. Scroll down to the MySQL users section and add a new user.
Add a username and a password by manually typing in the field or by clicking the Password Generator button to generate a strong password. A pop-up will appear with the generated password. Tick on the checkbox that says, “I have copied this password to a secure location”. Click on the Use Password button to populate password.
If you’re not happy with the password, you can repeat the process. Then, click on the Create A User button.
In the next window, you should see successfully created a MySQL user named “x2demo1_newuser” message. Click on Go Back button to return.
Next, you need to add this new user to the MySQL database. To do this, scroll down to Add a user to a Database section and select the user along with the database from the drop down menus and then click on Add button.
Finally, you have to manage user privileges by clicking All Privileges. Click on Make Changes button to save. You should see a successful message above it. Click on Go Back button to return.
Your MySQL database should be ready now. You can use it to restore your WordPress database backup.
Now, go back to your cPanel Dashboard. Click on the phpMyAdmin icon under Database Tools.
You will then need to import your database. Click on the Import button.
Then, click on Choose File button to select your WordPress database backup file from your computer. Then click on the Go button right at the bottom of the page to continue.
PhpMyAdmin will now upload your backup and import it into your database. This could take a while depending how big your database is. You should see a success message when done.
Congratulations, you have successfully imported WordPress database. Up next, you’ll have to manually restore WordPress files by using an FTP client.
When you’re ready, let’s proceed.
How to Manually Restore WordPress Files Using FTP
The first thing you need to do is download a fresh copy of WordPress from the WordPress official website and extract it to your computer.
As of this writing, the most latest stable release of WordPress is version 4.8.1.
Take note that if you have a complete WordPress files backup, no need for you to download a fresh copy. Just upload the backup to your server.
In addition, if you’ve only backup wp-content folders and wp-config.php file, then you have to do it.
When everything is ready, let’s proceed.
Now, all you need to do is launch your FTP client and then upload the extracted WordPress files to the server.
You can get this FTP credentials from your web host.
You’ll see a notice if you are successfully connected to the network.
The uploading process can take a while depending how big your website is. Just sit back and relax.
Once you’ve done uploading WordPress files, you can now upload the wp-config.php file from your backup. You can edit this file using a code editor (ie. notepad++) and enter your database information.
Save it and upload it back to your server.
Now, upload wp-content folder backup.
Alright, that should restore WordPress files. To check if everything is working fine, login to your WordPress dashboard. Go to Settings » Permalinks and update it to match with the old permalinks.
Visit your website, it should work properly now.
Restoring WordPress website from backup can be time-consuming. It also comes in different ways.
What you have just learned today is restoring a website from backup manually.
I’d be updating this guide which might include restoring WordPress using UpdraftPlus backup and BackupBuddy.
For now, I look forward to reading your comments on your experiences restoring your website. Let me know in the comments!