Even though most web hosting providers offer automated backups and there are a number of plugins which can create further redundancy, any developer must know how to backup (and restore) a WordPress site manually. Personally I dislike using plugins, and will always do my backups and restores manually as long as I have the right tools and time. 

In this post we’ll go over how to backup a WordPress database and site files, which are two separate actions, and then how to delete and restore the WordPress database and site files. By the end of this tutorial you should feel comfortable working with PHPMyAdmin, and understand where to access your site files whether you’re in a localhost or Cpanel environment.

I’ll be working on my local WAMP by Bitnami stack, but you can follow along in whatever local or control panel environment you happen to be using, so long as it employs PHPMyAdmin.

How to Backup a WordPress Database

PHPMyAdmin is probably the most common tool used for accessing and working with WordPress databases, so it’s likely that you will use it at some point during your time with WordPress. 

Before backing up a WordPress database, it’s important to make sure you’re getting the database you want. Even if you only have one website on your hosting account, there will probably be a few databases visible in PHPMyAdmin. 

There are two easy ways to check which website a database is connected to. The first is through the WP-Config.php file, which should be easy to find in the root folder of your WordPress installation. 

backup wordpress database manually

Open WP-Config up in a text editor, and near the top you’ll see the database name, user, and password labelled within the code. This is a quick way of determining which database is connected to a website if you can easily access the website’s files, whether through the root folder in your local installation or through File Manager in a control panel.

backup wordpress manually

The second way to determine which database to backup is through PHPMyAdmin itself. Click on the database in question on the left sidebar menu, and then click on “Options” as demonstrated in the screenshot. This will display a screen which includes the URL of your website, as shown below.

backup wordpress options
backup wordpress site name

If you are certain that you’ll only be transferring or restoring your website to an environment that uses PHPMyAdmin, you can do the “Quick” backup by simply clicking on the Go button. However, if there’s any chance you might be moving to an environment without PHPMyAdmin (such as an unmanaged VPS) it’s important to do a custom backup and check the function selected in the screenshot below.

backup wordpress database export
backup wordpress drop function

Once you’ve determined which type of backup to do, click on Go. It may take a few minutes for the SQL file to compile, so be patient. When it’s ready to download, save the SQL file to a location where you can find it easily. This is the backup of your WordPress website’s database.

How to Backup WordPress Site Files

The next step is to backup your WordPres website’s files. First you need to access the files, so open up the containing folder on your desktop or control panel environment. Either compress the folder containing the files, or else select all the files and compress them into a new zipped file. If you use File Manager on cPanel, you’ll have the option of creating a Gzipped TAR archive, which is probably the most efficient way of transporting a WordPress website.

To compress a folder on Windows 10, simply right click on it and then mouse over “Send To” and click on “Compressed (zipped) Folder”. This will copy and zip the entire folder or all of the files you have selected.

backup wordpress website files

Congratulations! You’ve officially completed a manual backup of your WordPress website database and files. You can save these to your hard drive, an external drive, or a cloud environment for safe keeping. I recommend creating backups of your website at least as often as you update its content.

How to Delete a WordPress Database in PHPMyAdmin

No that we’ve got the entire website backed up as SQL and ZIP files, we can have some fun by deleting and then restoring it. First, we’ll delete the database. 

There are actually two ways of getting rid of a WordPress database in PHPMyAdmin. One is to delete it completely, and the other is to merely delete the contents by dropping all the tables.

To delete the entire database, select the database in the left sidebar and then click on the Operations tab as shown below. Click on the red Drop the Database link, and a prompt will open asking you if you’re certain. If you really are, click OK, but keep in mind that in order to restore a deleted database you will have to first recreate it and then populate the tables with the SQL file.

delete wordpress database
delete wordpress database permanently

If you prefer the simpler, quicker option, you can just drop the tables by selecting the “check all” box shown below.

Once that is selected, click on the menu labelled “With Selected” and scroll down to “Drop”. Clicking on drop and confirming will remove the contents of the database, leaving it empty but still present.

In order to make sure you’ve successfully deleted the database, attempt to navigate to your site in your browser of choice. If you see the following screen or something similar, it means the files and database information are both missing.

wordpress website not found

If you see the WordPress install page, it means that the database is either missing or disconnected but the website files are still present. To finish deleting your website, delete the folder containing your WordPress installation. 

How to Restore a WordPress Database in PHPmyAdmin

In order to restore your WordPress database, first select the empty database or re-create it using the same name if you deleted it entirely. Once you have selected the empty database, click on the import tab as shown below.

restore wordpress website

On the import screen, click on the Choose File button and select your SQL database backup. Click open, and then click the Go button. The database will be imported, and you should see the following screen:

website restore successful

Click on the name of the database in the left sidebar again to open it, and you should see all of the tables are populated as they were before the drop.

restore website files

To restore the website files, right click on your zipped folder and select Extract All. A window will open in which you can select the correct location for your WordPress files. The extraction may take a few minutes depending on your software, but when you’re finished you should be able to access your fully restored website again!

Conclusion

Being able to manually backup and restore your WordPress website is an essential skill for any developer, and it is the backup method least prone to error. Although backups provided by your hosting company or an automated plugin are convenient, there is no alternative for keeping your own manual website backups on hand. 

Share This