How to Backup and Restore Your WordPress Website Safely

backup and restore your WordPress website

Having a WordPress website isn’t enough, you should know how to backup and restore your WordPress website. Backing up is always recommended whereas restoring the backup is required in case your website gets hacked.

You would also need this if you change your domain name or shifting from one web hosting to another.

These are the necessary concepts you should have an idea about. It’s no need to mention that many people face the fatal of being hacked.

I don’t think any of you would like that.

It’s always good to remain prepared. For which, you should know the procedure to backup and restore your WordPress website.

In this article, you will see the manual method which is easy to apply.

Start Backup Your Website From the cPanel

You can also back it up using the plugins like UpdraftPlus. But today, I am going to show you the manual way of backing up your website.

Step 1: – Login to your cPanel and search for the files’ section. Open the File Manager. After the cPanel has revamped, the file manager will open in a new tab.

You can do its settings from the top-right corner. Make sure you check to show the hidden files.

You have to open the PUBLIC_HTML directory because your website data is in this root directory.

Step 2: – Once you open it, you will see all the files and folders of your WordPress website. Select all using the button shown in the navigation menu.

backup your website

Click on the “Compress” option.

It will show you a popup asking you to choose the file type. You have to select the ZIP file option. Scroll down and you will see the future location of this ZIP file.

By default, you will see public_html/cgi-bin.zip but you can change it so that you can recognize the backup file.

backup a website

Write something like public_html/Mybackup.

You have already chosen the file extension above. Click on the “Compress File(s)” button and the compression will start.

Depending on the size of your website, it will compress the files and another popup will appear.

Click on the close button.

Step 3: – If you don’t see a file with the same name you have added for the backup, just refresh the page using the option given in the navigation menu.

Download backup

You will see a ZIP file with the name you have chosen. Just double click on the file and the download will start.

You can also use the right-click to see the download option. The backup file will get downloaded to your computer depending on the size of the file and the internet speed you have.

Backing Up the WordPress Database

It’s not enough to backup the websites data. You can’t run a website without its database.

Do you know how to export the database? If you don’t, I am going to walk you through. Just follow the guide properly.

Step 1: – If you have already logged into the cPanel, you have to search for the database’s section. Click on the phpMyAdmin icon.

A new tab will open.

Step 2: – On this page, from the left-side list, you have to select the name of the database of your WordPress website.

backup your wordpress website

Once you click to that, many database tables will appear to you. For backing up, you just have to click on the “Export” option shown in the main navigation menu.

You don’t need to change anything here. Just click on the “Go” button and the download will get started.

Within a few minutes, the database file will get the download to your computer.

You have successfully backed up the WordPress website and the database. But I am not finished yet.

Restoring the Backup Has Never Been So Easy Like Now

When you have the backup of your website, you can restore it anytime you want.

Many people move WordPress from one domain name to another or even migrate their website from one web hosting to another. During this process, you need to backup and restore your WordPress website.

Let me start.

Step 1: – Just like before, login to your cPanel account and open the file manager. You will see an “Upload” option in the main navigation menu.

Upload backup

Once you click on that, a new tab will open. You will see a button to choose the file from your computer.

Choose the backup file you have downloaded earlier and started uploading it. Once it gets uploaded, return to the root directory/public_html.

Step 2: – After refreshing, you will see the ZIP file you have upload. You have to extract it. Either use the right-click or use the option given in the menu.

Once you extract it, you will see all the files and folder of your website. You can delete this ZIP file after that.

You’re not done yet. You have to upload the database file.

Start Importing the Old Database File of Your WordPress Website

Do you know how to import the database? For uploading the database, you need to create a new database.

If you’re uploading the database on your same website, same web hosting, the same location then you don’t need to create a new database.

A new database is required if you change the domain name, the web hosting or the location of your website.

Step 1: – Open the phpMyAdmin from the database’s section. A new tab will open.

Just like before, you have to click on the database name from the left-side list.

Step 2: – To upload the database, click on the “Import” option shown in the main menu. You will be showing a button to choose the file from your computer.

import database

Use this button and start uploading. But if the database size is bigger than you have to increase the upload file upload limit.

If you’re running your website for quite a long time then it’s obvious that the database size may be bigger than the default file upload limit.

If you don’t get any notification then carry on and finish uploading.

What to Do After Uploading the Backup

You can backup and restore your WordPress website as shown so far. But what’s after that? You may get some errors.

You should know about common WordPress errors and their solutions.

Whenever you import the database to a new database, you have to update the database credentials. Otherwise, you will get “Error establishing a database connection” while opening your website.

To fix this, you have to edit the wp-config.php file.

I hope, you know how to edit this file. This is one of the important files of the WordPress directory because it’s the reason your website makes a connection with the database.

You have to update the database name, host name, database password and other database credentials as same as your new database.

If you haven’t created a new database, you wouldn’t get any error.

You may also get the DNS error if you have changed the web hosting. It’s because every web hosting server has its own DNS server name.

At such situation, you can update it.

If you have bought the domain name from a third party domain name provider like GoDaddy, you can just copy the server names from your new web hosting and paste those in your GoDaddy account.

If you don’t get any error, that’s perfect. You have successfully accomplished to backup and restore your WordPress website.

If you still face any problem, feel free to drop a comment. You can also connect with us on Twitter, LinkedIn, and Facebook.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, theme development, design issues and what not.

4 comments

  1. Hi Ravi,

    Nice Informative Post!

    Yes, knowing the procedure to backup and restore our wordpress website is a must as no one knows what will happen tomorrow so it’s better to be prepared.

    Following your step by step process one can easily backup and restore their wordpress website.

    I will tweet your post.

    Thanks a lot for sharing.

  2. Hi Ravi
    This is a pretty informative post. Recently, I was playing with WordPress coding and ends up with messing up everything. I realize my stupid mistake but thanks to backup of WordPress files. Restored them and got some relief.
    Restoring through cPanel also seems easy.
    Thanks Man for sharing.

  3. Hi Ravi,
    This is no doubt a must read for all WordPress users, I mean all bloggers. 🙂
    Very well explained the process through this post.
    I am bookmarking it for my further use.
    Thanks for sharing.
    Have a good day
    Best
    ~Philip

Leave a Reply

Your email address will not be published. Required fields are marked *