WordPress Backup & Restore With cPanel

3

It happened to me one day. After having spent several gruelling hours trying to do a WordPress backup on my site, I was unsuccessful. I had tried every (freely :D) available site backup plugin for WordPress, plugins which had gotten rave reviews. But my efforts were in vain. And the problem wasn’t very clear. So, the first thing I did, was turn to Google for an answer. Seems like the obvious thing to do in such situations. But… nothing seemed to help.

Then, I weighed up my options. One option of course was to use a paid plugin – I tried my luck there, but I was a tad bit skeptical about it working, owing to the fact that none of the free plugins worked. So I chose an alternative option.

I took the help of a developer friend to backup the files manually, using cPanel. And it worked! Phew! And it didn’t even take up much of my time. It’s like I was sitting there trying to change the TV channel with a remote, when the whole time, I could have just walked over and changed the channel myself.

Maybe most of you would find success with a backup plugin for WordPress. But for those of you who find yourself stuck in a similar pickle, here’s what you have to do.

WordPress: Which Files to Backup and Why

Before we begin, here’s a little bit of ‘did you know’, about your WordPress site. Did you know, your WordPress site has files and directories which have been added when you install WordPress, and a database where the site content is stored? If you connect to your website using cPanel (or your preferred FTP client), you should be able to see this directory structure. These directories will be placed under a root directory (often, public_html).

WordPress File Structure

Inside this root directory, you should find several wp- files and directories. The most important file here is wp-config.php. This file contains important information related to your site, and connects your site to the database. A backup of this must be taken successfully.

Other important files which must be backed up are your .htaccess file, index.php and xmlrpc.php. The .htaccess file resolves your URL structure, to correctly display content using index.php. The xmlrpc.php file is used to remotely access your WP site.

The wp-admin and wp‐includes directories contain files which are required to access your dashboard, control administrative information, and core files needed to boot your website. The wp-content folder contains your plugins, themes and uploads. If you lose this folder, you will have to install your plugins and themes again, and will lose all files in your media library.

WordPress Database

Your WordPress database can be accessed directly from cPanel. The database by far contains the most important content, and must be backed up on a regular basis. It contains user information, content on your website, and plugin and theme related data.

Backup Your WordPress Site Using cPanel

Now, to backup your WordPress website, you have to login to cPanel. We’ll first backup all the files and then the database.

WordPress Files Backup

  1. Go to Files Manager.
  2. Inside Files Manager, you should be able to see your WP directories and files.
  3. Select and compress wp-admin, wp‐includes, wp-content, all files which have a wp- prefix, index.php, xmlrpc.php.
  4. At this point you will be prompted to provide a location where the compressed file will be saved.
  5. Rename the name of compress file if you wish to do so.
  6. Download this compressed file (if you encounter problems while downloading the file, connect using an FTP client, and then download it).
  7. Upload this file to Dropbox (or any preferred location), and then delete this ZIP from the location it has been compressed to using the cPanel.

WordPress Database Backup

  1. To backup the WordPress database, go to cPanel again.
  2. You need to know your site’s database. If you do not know which is the current database of your site, you can head over to Files Manager, and open wp-config.php. The database name will be present in that file.
  3. Find phpMyAdmin in cPanel.
  4. Go to the database and click on Export.
  5. On the Export settings page, customise the following options:

    1. Set the backup file type to GZIP (or ZIP).
    2. Set Max Length of Created Query to 0 (so as to avoid truncation of queries).
  6. Hit Go.
  7. Upload the file to Dropbox.

So, now that you’ve successfully backed up your WordPress site, these files will come in handy if you have a problem. However, you have to know how to restore these files, when needed.

Restore Your WordPress Site Through cPanel

Before restoring your site, backup your files once again. I’m not kidding! At the very least, backup your database. Then, start from the final step in the backup procedure, and do the exact opposite! It’s simple. Here’s what you have to do:

  1. Download the files from Dropbox
  2. Go to cPanel, phpMyAdmin
  3. Import the database file to the database. To be on the safer side, you can create a new database, import the file, and change the database name in wp-config.php.
  4. Go to Files Manager. Upload and extract the zipped WordPress files and folders (you can also do this using an FTP client).

Final Words

Although it is recommended to use a WordPress plugin to backup your WordPress site, if you don’t have an option, this method will help you out. It certainly worked for me! Let me know if you have any additional questions or have suggestions for fellow readers in the comments below.


This post was written by Namrata Godkar. We are very grateful that Namrata has written this post for us, however, the views expressed here belong to the author, and do not necessarily reflect the views and opinions of wpContent.
Share.

About Author

Namrata is a tech blogger working at WisdmLabs, where she writes about solutions with WordPress. When not blogging, she enjoys travelling and photography.

Leave A Reply

  • http://meditationyoga.in wise

    GREAT! Just what I was looking for. Thanks!
    When restoring from the backup and importing to a new database, should I delete the old database afterwards?

  • Opeyemi Adebola

    how can move my website from my old hosting account to a new hosting account after doing the backup of the web content and database content just as you illustrated here. NOTE: both accounts are hostgator…..

  • iansdell

    Thanks for a brilliant tutorial. I was able to move my sites very easily from a host whose restrictions prevented migration plugins from working. In some ways, it was easier than using a plugin!