WordPress Backup and Restore Procedure in Details

Backup and Restore of WordPress Website

Backup and Restore of WordPress Website

A website owner worst nightmare is when his website fails to load, been hacked or just fallen into pieces. Therefore it becomes very important for them to know how to take backup of their website and restore it when there is a need. In this tutorial we will explain you how to do Backup and Restore of your WordPress website.

WordPress Backup Procedure

A WordPress website backup is split on two things – the first is the ‘Database’ where the website information is stored. This contains every post, pages, products, links, etc your website has. The second is of the ‘Files’ in the 3 folders named ‘plugins’, ‘themes’ and ‘uploads’, these are kept inside the ‘wp-content’ directory (‘wp-content’ directory is in the root of your folder of your website). Let’s discuss them one by one.

1. WordPress Database Backup Procedure

The procedure of database backup is different in Windows and Linux hosting. Below we have mentioned how to do it in both of them.

a. WordPress Database Backup in Plesk Panel

First log in to your hosting account. If your hosting based on Windows OS you will reach ‘Plesk Panel. Follow the steps given below –

1. Click ‘Backup Manager’ in the top right corner.

Backup Manager in Pleak Panel

Backup Manager in Pleak Panel

2. Under ‘More Actions’ tab click ‘Database Backup Repository’.

Database Backup Repository

Database Backup Repository

3. You will be taken to a new page where you need to select the database from the database drop down control and then click the ‘Back Up’ icon at the top.

Backup Icon in Plesk Panel

Backup Icon in Plesk Panel

4. A new page opens where you enter the name of the database backup file and then click OK button to save it.

Entering Database Backup Name

Entering Database Backup Name

5. Now you get a message to download the database backup file. Just click the database backup file, which you have just created, to download it to your local PC.

Downloading Database Backup File

Downloading Database Backup File

b. WordPress Database Backup in cPanel

If your hosting is based on Linux OS then after you have logged in to your hosting account you will be taken to cPanel. Here go to the backups page by clicking the ‘Backups’ icon.

Database Backup in cPanel

Database Backup in cPanel

Under heading ‘Download a MySQL Database Backup’ click the database to start its download to your local PC.

Downloading Database Backup in cPanel

Downloading Database Backup in cPanel

If you have more than one database in your Plesk or cPanel and you are unsure which database your WordPress website is using. Then you can open ‘wp-config.php’ file (which is located in the website root directory) in FileZilla and see the below line –

define('DB_NAME', 'i604309_wp2');

The second parameter in the define function is the used database name i.e. ‘i604309_wp2’.
In this way we can take WordPress Database Backup easily using Plesk or cPanel.

See our article Using FileZilla FTP Client to Upload and Download Files from Hosting Server for more information about using FileZilla.

2. Procedure of WordPress Files Backup

Here we will show you how to make the backup of the files contained in the folders ‘plugins’, ‘themes’ and ‘uploads’. You will need to create FTP account from your cPanel or Plesk Panel. Then connect with your website in FTP protocol. You can use FileZilla to connect to your website in FTP protocol.

Then Follow the below procedures.

1. Create a new folder in your PC hard disk drive.

2. Navigate to this newly created folder on the left side of FileZilla.

3. On the right side of FileZilla select the three folders ‘plugins’, ‘themes’ and ‘uploads’. Drag and drop them on the left side of FileZilla. This will copy them in your local PC.

4. Go to the root folder of your website on the right side of FileZilla and locate ‘wp-config.php’ file. Drag and drop it on to the left. You will need this file during database restore section.

Wordpress Files Backup with FileZilla

WordPress Files Backup with FileZilla

Now you have the WordPress Database and file backup in your PC so you can go ahead and Restore WordPress From Backup anytime if there is a need.

Restore Backup

First reinstall WordPress in your domain from your cPanel or Plesk panel. You will find ‘WordPress’ under the ‘Application’ area. Note that reinstalling WordPress will remove all previous wordpress files and will also create a new database for it. It will also create a new ‘wp-config.php’ which now has new database settings. But we need it to contain the old database settings therefore update the following entries in the new wp-config.php file and make them same as that in the previous file –

define('DB_NAME', 'WpCommon');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');

You can get the pervious database information from the ‘wp-config.php’ file which we have backed up previously. Alternately you can just replace the new ‘wp-config.php’ file with the backup version.

Now follow the following steps –

1. Procedure of WordPress Database Restore

Since now we are using the old database so open the database in phpMyAdmin. In Plesk panel, to open the database in phpMyAdmin, click ‘Databases’ icon then in the page that opens click ‘WebAdmin’ against the database used by the wordpress. In cPanel you will find phpMyAdmin under the heading ‘Databases’. Click phpMyAdmin to open the database.

Opening Database with phpMyAdmin in Plesk Panel

Opening Database with phpMyAdmin in Plesk Panel

Now follow the steps –

1. In the phpMyAdmin click the database name given on the left side.

2. The page which opens will show all tables, click ‘Check All’ to select all the tables.

3. In the dropdown menu ‘With Selected:’ select ‘Drop’.

Selecting and Dropping all Tables from WordPress Database

Selecting and Dropping all Tables from WordPress Database

4. You will get a message asking whether you are sure to execute the query. Click ‘Yes’ button to drop all the tables. After the query executes you will have an empty database.

Confirmation before Dropping all Tables from WordPress Database

Confirmation before Dropping all Tables from WordPress Database

5. Now we begin with the main part to restore the database. So click the ‘Import’ link at the top. Click ‘Choose File’ or ‘Browse’ given against ‘Browse your computer:’. Navigate to your ‘database backup file’ that you saved in your PC during wordpress database backup section. Leave all the other options to their defaults, click the ‘Go’ button. Your database backup will be restored to the backed up state.

Restoring WordPress Database by Importing Backup in phpMyAdmin

Restoring WordPress Database by Importing Backup in phpMyAdmin

If everything goes as expected you should see the success message.

Success Message when Import Finishes

Success Message when Import Finishes

2. Procedure of WordPress Files Restore

You may remember that we backed up the 3 folders ‘plugins’, ‘themes’ and ‘uploads’ in our local PC hard drive. Now we will move them from our local PC to our WordPress website location. So connect to your website in FTP protocol using FileZilla. On the left side of FileZilla, go to the location where you have saved these 3 folders. On the right side double navigate inside the ‘wp-content’ folder. Now select the 3 folders on the left and drag and drop them on the right. Keep in mind that you drop them below the last folder on the right and not over any of the folders there. If it asks for replace do yes. It will take some time before all files are uploaded. That finishes our WordPress file restoring part.

Restoring WordPress Files from FileZilla

Restoring WordPress Files from FileZilla

In this way you can do Backup and Restore of your WordPress Website. Just keep in mind to take at least one backup every 15 days so that in case of any problem you have the proper backup with you. Hope you have got all your answers in this tutorial, feel free to comment in the section below.

Share this article -

yogihosting

ABOUT THE AUTHOR

This article has been written by the Technical Staff of YogiHosting. Check out other articles on "WordPress, SEO, jQuery, HTML" and more.