Keeping a backup copy of your website can save a lot of aggravation down the road. ItâÂÂs better to be prepared in the event of a catastrophe. But what if you only have a backup of the database?
Not everyone keeps complete backups on hand. And if something drastic happens on your server, you could lose everything
So, what can you do to restore a WordPress database?
In this tutorial, IâÂÂll show you how to restore the website from a database backup in WordPress
Restoring a WordPress Database
Ideally, you would want a complete backup to quickly get the site back up and running. In this instance, itâÂÂs better to use UpdraftPlus
But letâÂÂs say that the website was completely destroyed and you only have the SQL database file saved to your computer
What then?
Create a New Database
WeâÂÂll need to start by creating a new database on your server. This will give you a location for which to import the data youâÂÂll use
Click MySQL Databases from the cPanel dashboard
Give the database a new name. This is the name of the database youâÂÂll use when you reinstall WordPress. IâÂÂm simply going to name it, âÂÂwpdb007.âÂÂ
Take note of the prefix of the database name. You will need this to connect your website. It may look something like, âÂÂ
**test You will need the text and the underscore before the database name
So, the name as a whole would look kind of like, âÂÂ
**test_wpdb007
Click the âÂÂCreate Databaseâ Button. This will save the empty file to your web hosting server
Once the database is created, click the link to âÂÂGo Back.â This will take you back to the MySQL Database page
Create a New User
To recover a deleted WordPress site from a backup of the old database, you need a new user. This is the login information that lets WordPress connect to the new database. Without it, the website wonâÂÂt have access to the information
Scroll down to the âÂÂAdd New Userâ section of the page
Input a new username, password and click, âÂÂCreate User.âÂÂ
ItâÂÂs probably a good idea to write down these credentials for when you reinstall WordPress. ItâÂÂll make it easier to remember the log in information. And donâÂÂt forget to take note of the prefix to the username
It should be the same as the database
Add User to Database
Scroll down to âÂÂAdd User to Database.â You need to make sure WordPress can connect to the site with this account
Use the drop down boxes to select your user and database
Click the âÂÂAddâ button
On the next screen, click the box for âÂÂAll Privileges.â This will give WordPress full access to the database
Click the âÂÂMake Changesâ button on the bottom
The account is now ready for WordPress to use it
Importing the Website Database Backup for WordPress
Now that we have an empty database ready to go, itâÂÂs time to upload the file
Go back to cPanel and click âÂÂphpMyAdminâÂÂ
Find your database in the list and click it
Click the âÂÂImportâ option from the top toolbar
Click the âÂÂChoose Fileâ button and select the database from your computer
Make sure the Format is set to SQL and click, âÂÂGo.âÂÂ
After a few moments, the database will be ready. How long this takes is dependent on a few factors. For example, database size and Internet upload speeds will affect the amount of time it takes to import
Adding the Database to Restore the Website
With the database filled and ready to go, itâÂÂs time to add it to WordPress
Now, youâÂÂll have a couple of ways to install the content management system. You can use easy methods, such as installing WordPress with Softaculous. However, some people like to install WordPress manually
Unfortunately, Softwaculous does not have the ability to use an existing database when setting up WordPress. It only works for new sites with unique databases
When installing WordPress manually, youâÂÂll come to a page for the database. Input the database and credentials of the account you created earlier
Once you click âÂÂSubmit,â youâÂÂll get a message stating WordPress is already installed. This is normal
All you need to do now is click the âÂÂLog Inâ button and access your website normally
Restoring the Rest of the Site
Unfortunately, the database doesnâÂÂt hold some of the other nuances you might have had on your site. Things like plugins, images and themes will need to be added again
However, you might be able to search your browserâÂÂs cache for some of those images or retrieve them through a cache of your site on search engines
This is one of the reasons why I suggest using plugins like UpdraftPlus or other backup tools. You wonâÂÂt have to worry about trying to find all of these elements
And there are plenty of plugins to choose from for creating a complete save of your site
It simply makes recovering deleted WordPress sites easy from a backup
Never Underestimate Redundancy
Having a backup on hand saves a great deal of trouble, lost traffic and possibly lost income. DonâÂÂt wait too long to have a proper method for creating copies of the site. Whether itâÂÂs a server crash, hackers or malware, not having a quick and easy plan can prove to be devastating
What kind of backup methods do you have in place? Do you find it useful to backup files to the Cloud?