If your WordPress website was accidentally deleted, would you be able to recover it? Unless you have a backup copy on hand, you’ll have to rebuild your website from scratch, which can be tedious and expensive. Some webmasters have even been forced to shut down their website because of data loss.
The good news is you can protect your WordPress website from suffering a similar fate by creating backups. Because the content management system (CMS) stores and retrieves data from a MySQL database, though, creating a complete backup requires more than just copying your site’s files.
What Is a Complete WordPress Backup?
A complete backup of a WordPress website consists of two primary elements: the site’s files and its MySQL database. Like with many other CMSs, each WordPress installation uses a MySQL to store and retrieve data. If you publish a new post, for example, it’s stored in a MySQL database rather than an actual file that you can access using a File Transfer Protocol (FTP) program. Therefore, you must copy the MySQL database. Otherwise, your backup won’t contain your posts, nor will it contain any comments left by visitors.
In addition to the MySQL database, you’ll still need to copy your website’s files to create a complete backup. FTP-accessible files contain several types of important data, including the following:
- WordPress installation
Why Should I Create a Backup?
Creating a backup of your WordPress website will allow you to restore your site if it experiences a data loss event. No website is immune to data loss, regardless of the CMS powering it. Maybe the server on which your website is hosted crashed, or perhaps a recent WordPress update corrupted your site’s installation files.
Viruses or other forms of malware can cause data loss as well. Statistics show over three-quarters of WordPress websites are vulnerable to cyber attacks. If a hacker deploys a virus or malware on your website, your only recourse may be to restore it from a backup.
You may never need to use a backup, but the peace of mind it provides knowing that you can roll back your site to an earlier date makes it well worth creating. From accidentally deleted files to corrupted data and malware, a backup can bring back your website’s lost data.
Step 1) Download Your Website’s Files
To get started, download all your website’s static files from the server on which it’s hosted. Assuming your website runs the self-hosted version of WordPress and not the hosted version, you should have FTP access, meaning you connect to the server to download or upload static files using an FTP program like WinSCP or FileZilla.
Just launch your preferred FTP program, enter your website’s address, as well as the username and password provided by your web host, and click the “connect” button. Once connected, you should see a list of folders in the program’s graphical user interface (GUI). Locate the folder containing your website’s static files. You can then download the folder, which includes all your website’s static files, by right-clicking it and choosing the “download” option. The folder and its contents will then be copied to your computer. Just remember to take note of where exactly the folder saved to on your computer.
Step 2) Download Your Website’s MySQL Database
Next, you’ll need to download your website’s MySQL database. While also stored on your website’s server, you can’t access MySQL databases using an FTP program. Instead, you’ll have to use your web hosting control panel. Most web hosting services include a control panel, the most common of which is cPanel. To access it, you typically enter a special address into your web browser like example.com/cpanel, followed by entering the user name and password provided by your web host.
After pulling up your website’s web hosting control panel in a browser, search for an icon or link titled “phpMyAdmin.” Clicking this icon or link will direct you to a GUI featuring all the MySQL databases that you created on your web hosting account. If you have multiple WordPress websites on your account, you’ll have multiple MySQL databases listed in phpMyAdmin. If you only have a single WordPress website, you’ll only have a single MySQL database listed.
After locating your website’s MySQL database — the one listed in your website’s WP-config file, which you can access and open using an FTP program — click it once to select it. Next, click the “Export” button at the top of the phpMyAdmin GUI. Verify the format is set to “MySQL” and click “Go” to download a copy of your website’s MySQL database.
If you need help using your web hosting control panel, contact your web hosting provider. They can provide you with the address, username and password needed to access your web hosting control panel and download your website’s MySQL database.
Alternative Ways to Create a Backup of Your WordPress Website
An alternative way to create a backup of your WordPress website is to use a backup plugin. There are over a half-dozen plugins designed specifically for backing up WordPress websites, some of which include UpdraftPlus, BackupGuard, All-in-One WP Migration and Duplicator.
If your website uses cPanel, you can use a tool in the web hosting control panel to create backups. Clicking the icon or link titled “Backups” in cPanel allows you to download a complete backup of your website, including its static files and the MySQL database. The only downside to using this method is that it creates a backup of all your websites. If you manage multiple websites, they’ll all be included in the backup.
As a webmaster, you’ve probably invested dozens of hours into building your website. If a data loss event occurs, you may have to start over again. You can’t always prevent data loss, but you can mitigate or even eliminate its effects by creating backups. By getting into the habit of creating backups on a regular basis, you can rest assured knowing that data recovery is just a few clicks away.