In this tutorial I will show you a 2 step process for a full backup of your WordPress Website. This is an important task as discussed in Tip3 of my previous tutorial about WordPress Security. This tutorial mainly focuses on manual backups of self-hosted WordPress Websites.
Why Backups are important? Because you cannot depend on your Web host to keep a current backup of your Website. Also, you can protect your Website from crackers by making regular WordPress backups. Making backups is essential because problems inevitably occur and you need to be in a position to recover fast.
A complete WordPress backup is not difficult if you know what to do. Your WordPress Website consists of two parts: Database and Files. Therefore, for a complete backup, you need to backup your WordPress database AND your WordPress Files.
Step1. Backup your Database using phpMyAdmin
Your WordPress Website is powered by a MySQL database which contains all of your content and the settings for your Website. If your database gets damaged or erased your Website would be like an empty shell without content. Your database needs to be backed up separately from your WordPress files.
I strongly recommend that you backup your database regularly and before any upgrades. Restoring your database from a backup is then possible if something goes wrong.
To create a backup copy of your WordPress database, you can do that from your phpMyAdmin Web interface using the Export function. How to do that?
- Log into your phpMyAdmin
- Select your WordPress database
- Click on the Export tab on the top set of tabs
- Look at the top left box of the Export section. All the database tables you selected are in that box.
- WordPress tables usually start with "wp_" or whatever table_prefix you specified in your wp-config.php file.
- If you only have your WordPress blog installed in that database, make sure to "Select All" unless you are making a custom backup for a specific purpose.
- Ensure that the SQL radio button is selected.
For the Structure section
Check the boxes as shown in the image below.
For the Data section
Check the boxes as shown in the image below. Complete inserts and Extended Inserts are mostly cosmetic changes to the output style, though Extended Inserts can help if you are having issues with the file size.
- Check None for compression. If your database is very large use any compression option.
- Keep remember template checked.
- Now click Go and save the file to your computer.
- You have now backed up your database.
See the image below:
REMEMBER: You have NOT backed up the files and folders (like images, videos, etc.), but all your posts, comments and WordPress settings are now safe.
"Add DROP TABLE / VIEW / PROCEDURE / FUNCTION"do?
It will drop (remove) the existing tables before recreating them again. This ensures that the tables creation is successful. If you don´t check this box you may need to drop the tables that you want overwritten before importing the database.
Step2. Backup your Files
The database content is not enough for a complete backup, you also need to backup your files. In general a WordPress Website consists of several components:
- Core WordPress files
- WordPress Plugins and Themes files
- Your other specific files (images, videos, audio, custom files, etc.)
All of these components are used to generate your Website. These need to be saved.
Since you can always obtain the core WordPress files from the WordPress Website. At the least you need to backup the wp-content folder and all its content. This folder contains your theme(s), your plugins, all your uploads, and any custom files you have. Besides the wp-content folder, there are 2 other files that you should also copy which are: wp-config.php file and the .htaccess file (if it exists). My advice to you is to also include the core WordPress files. This ensures that you have a complete backup of everything related to the structure of your WordPress installation.
Using an FTP program, such as FileZilla, you should backup your WordPress files by downloading them to a folder on your computer or to an external drive. This step will only work if you have a self-hosted WordPress Website.
Remember that this type of backup does not backup your posts, comments and other associated data. You must also backup your database as discussed in Step1 above. Also keep 3 backups of the files, just in case one gets corrupted or lost, and store them in different places.
The required steps for a complete WordPress Backup are Step1 and Step2 listed above. Here, in this section, I want to give you other alternatives that might help.
WordPress Export Function
This is an XML file that you can save for the purpose of importing it into a new WordPress install. This file is helpful and makes it easier to move your Website hosted in WordPress.com to a self-hosted WordPress installation.
From your WordPress dashboard, go to Tools -> Export and download an XML file of your Website’s content. This file, contains your posts, pages, comments, custom post types, categories, tags, and users. However, with this file you do not get all of your media backed up with it. While it is an easy backup, it is by no means complete. Once the Export file is created, it can be imported using the Tools -> Import SubPanel in WordPress dashboard.
This XML file is not a replacement of your WordPress database backup as discussed in Step1. It does not create your database tables and does not backup your media and structure files as discussed in Step2. Consider this file as an additional, sometimes useful and helpful backup. So you could add this, as I do, to your routine backup strategy.
Did You Know!
If your Website is hosted at WordPress.com, then WordPress will handle all necessary backups. But if you want to backup your content manually, you can use the Tools -> Export SubPanel in your WordPress Administration Panel. This is a good idea especially if you have multiple editors to your blog. Editors and administrators have the ability to delete any content, and there is no way to recover deleted material from your Website.
There are few WordPress plugins that automatically backup your WordPress database and some plugins also backup your WordPress files. However, I can´t vouch for any of them because I have not tried them. Feel free to try them and give us your feedback in the comments section. It is much easier for me to take the manual approach, I like to keep plugins at a minimum.
- XCloner Plugin
- WP-DBManager Plugin
- WP-DB-Backup Plugin
- How To Backup Your WordPress Blog Automatically
- How often should I backup?
You should backup on a regular basis, daily or weekly depending how active your Website is. Also, if possible, backup to a read-only media to ensure that your files have not been tampered with.
A sound backup strategy includes keeping a set of your entire WordPress installation (WordPress core files and database) in a trusted location.
- How many backups should I keep?
Most people make one backup and then overwrites it every time. But this is the wrong approach. A rule of thumb is to keep at least three backups and keep them in three different places.
- My database backup is huge. What can I do?
Often statistics and anti-spam plugins can add large amounts of data to your database. When backing up the database, this information is not important to keep. Do not select those tables during the backup process.
To have a full backup of your WordPress Website all what you need is implementing Step1 AND Step2. If you don´t take backups seriously, you might one day find out the hard way when your entire Website is gone.
Also regular backups, is one important factor in your Website´s overall security strategy as I discussed in my previous tutorial. Do you have more backup tips? If so, please share them in the comments section.
If you reached that far and liked this tutorial, link back to it. Thanks!