
If you want to know how to backup a WordPress site, the short answer is that you save two things, the files in your WordPress folder and the database that holds your posts and settings. You can do it from cPanel, by hand with File Manager and phpMyAdmin, from the command line, or with a plugin. This guide covers each method, where to keep the copies, how often to make them and how to restore one.
Key takeaways
- A full WordPress backup has two parts, the files and the database. WordPress.org says you need both to restore a typical site.
- In cPanel, download a home directory backup and a database backup. cPanel can restore those partial backups itself, but it cannot restore a full account backup without your host.
- Back up the database first and the files second. When you restore, put the files back first and import the database second.
- Keep at least three copies in different places, such as your hosting account, a cloud drive and your own computer.
- A backup you have never restored is unproven. Restore one to a test copy of the site before you need it.
What a WordPress backup must contain
WordPress stores your site in two places. The files sit in the WordPress folder on the web server. The database runs in a separate system, usually MySQL or MariaDB, outside that folder. Downloading the folder does not copy the database, and exporting the database does not copy your images or plugins.
| Part | What is in it | How you copy it |
|---|---|---|
| Files | WordPress core, themes, plugins, uploads, wp-config.php, .htaccess | cPanel home directory backup, File Manager, FTP |
| Database | Posts, pages, comments, users, settings | cPanel database backup, phpMyAdmin, mysqldump, WP-CLI |
The WordPress documentation singles out the wp-content folder and the wp-config.php file. wp-content holds your themes, plugins and uploaded media. wp-config.php holds the database connection details.
The export screen under Tools, then Export, is not a full backup. It creates an XML file with your posts, pages, comments, categories, tags and users. It leaves out themes, plugins and uploaded files.
Choose a backup method
| Method | Good for | What you need |
|---|---|---|
| cPanel Backup | Most sites on cPanel hosting | A cPanel login |
| File Manager and phpMyAdmin | When the Backup page is switched off, or you want only the WordPress folder | A cPanel login |
| Command line | Large databases and scripted backups | SSH access, and WP-CLI for the wp commands |
| Plugin | Scheduled backups sent to remote storage without logging in to the host | WordPress admin access |
Every hosting plan at WaseerHost uses cPanel, so the cPanel screens described here are the ones you will see on shared hosting and WordPress hosting. Hosting providers can switch individual cPanel pages off. If you cannot find the Backup page, use File Manager and phpMyAdmin instead.
How to backup a WordPress site in cPanel
The cPanel Backup page offers a full account backup and partial backups. Use the partial backups for WordPress. The cPanel documentation states that you cannot restore a full backup file in cPanel yourself, because that function exists only in WHM, the server panel your hosting provider uses. Partial backups restore through cPanel without help.
- Log in to cPanel and open Backup in the Files section.
- Under Partial Backups, find the Databases heading and click the name of your WordPress database. Your browser downloads it as a
.gzfile. - In the same section, click Home Directory. The download is a
.tar.gzfile that contains every file you own in the account, including thepublic_htmlfolder and your email. - Move both files into one folder on your computer and name the folder with the date.
If you are not sure which database belongs to the site, open wp-config.php in File Manager and read the DB_NAME line.
A full backup is still useful as an archive. Click Download a Full Account Backup, leave Backup Destination on Home Directory and click Generate Backup. cPanel names the file in the backup-MM-DD-YYYY format.
Back up manually with File Manager and phpMyAdmin
This route copies only the WordPress folder and its database, so the download is smaller than a home directory backup.
Export the database
- Open phpMyAdmin from cPanel.
- Select your WordPress database in the left panel.
- Click the Export tab.
- Leave Quick selected and click Go. Save the
.sqlfile to your computer.
For more control, choose Custom in step 4. Keep every table selected, pick gzipped in the compression box, leave the format on SQL, and tick the Add DROP TABLE option. With that option, an import deletes each old table before it creates the new one, so you can restore over an existing database.
Download the files
- Open File Manager in cPanel and go to the folder that holds WordPress. For the main domain this is usually
public_html. - Select the WordPress files and folders. Include
wp-config.phpand.htaccess. If you cannot see.htaccess, click Settings and select Show Hidden Files (dotfiles). - Click Compress, choose a Zip archive and confirm.
- Select the new archive and click Download. File Manager downloads files, not folders, which is why you compress first.
- Delete the archive from the server once the download finishes, so it does not use your disk space or sit in a public folder.
Back up from the command line
The WordPress documentation warns that phpMyAdmin cannot handle large databases. If an export times out, use mysqldump over SSH. The examples below come from the WordPress documentation, where db01.example.net is the database host, dbocodex is the database user and wp is the database name. Replace them with the values in your wp-config.php.
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p wp > blog.bak.sqlThe command asks for the database password and writes the dump to blog.bak.sql. To compress the dump as it is written, pipe it through bzip2.
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p wp | bzip2 -c > blog.bak.sql.bz2If WP-CLI is installed on the server, it reads the database details from wp-config.php for you. Run it from the WordPress folder.
wp db exportWith no file name, WP-CLI saves the dump as {dbname}-{Y-m-d}-{random-hash}.sql. This covers the database only, so copy the files as well.
Plugin or manual backup
A backup plugin runs inside WordPress. It can make backups on a schedule, and some plugins send the copy to remote storage, so nobody has to remember to do it. You can find backup plugins in the WordPress Plugin Directory or under Plugins, then Add New in your dashboard.
Manual backups need no extra software and they work when WordPress itself is broken, because cPanel and phpMyAdmin do not depend on the site loading. Someone has to remember to do them.
For most small sites the two fit together. Let a plugin handle the routine schedule, and take a manual backup before any risky change. WordPress.org also recommends a manual backup now and then on top of automatic ones, to confirm the process still works.
Before you pick a plugin, check on its directory page that it backs up both files and database and can store copies away from your server. Then run a restore with it once.
Where to store backups
WordPress.org suggests keeping at least three to five recent backups in different locations. It gives one on your hosting server, one in cloud storage and one on your local computer as an example.
The copy in your hosting account is the quickest to restore, but it is lost if the account or server is lost. The other two cover that case.
Treat every backup as sensitive. The archive contains wp-config.php with your database credentials, and the database contains user accounts and customer details. Never leave a backup archive in a folder that visitors can reach over the web.
How often to back up
WordPress.org gives a general rule and one fixed point. Back up small sites with few new posts once a week, back up busy sites daily, and always back up before an upgrade.
| Site | Suggested schedule |
|---|---|
| Brochure site or small blog that changes a few times a month | Weekly |
| Busy blog, membership site or online store | Daily |
| Any site, before an update or a move to a new host | One extra backup first |
To choose, ask how many days of posts, orders or form entries you could lose without real harm. Your backup interval should be shorter than that.
How to restore a WordPress backup
Restore in the opposite order to the backup. Put the files back first, then import the database. A restore replaces the current data, so download a fresh copy of the broken site first if there is anything in it you might want later.
Restore in cPanel
- Open Backup in cPanel and click Restore.
- In Select Restore Type, click Home Directory.
- Click Choose File, select your
.tar.gzbackup and click Upload. - Repeat the steps for the database backup with the database restore type.
If your host has turned on account backups, cPanel may also show a File and Directory Restoration page, which restores single files or folders from the server's own backups.
Restore manually
- In File Manager, upload your Zip archive to the WordPress folder and click Extract.
- Open phpMyAdmin, select the database and click the Import tab.
- Click Browse, choose your backup file, check that the format is SQL and click Go.
A Quick export has no DROP TABLE statements, so it needs an empty database. Delete the old tables first, or create a new database and user.
If the database name, user or password differs from the old one, update the matching lines in wp-config.php.
Restore from the command line
bzip2 -d blog.bak.sql.bz2
mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sqlWith WP-CLI the import is one command.
wp db import wordpress_dbase.sqlwp db import does not create the database. It only runs the SQL in the file against the database named in wp-config.php.
Test a restore before you need it
Do the test on a copy, not on the live site.
- Create a subdomain such as
test.example.comand a new, empty database with its own user. - Extract your file backup into the subdomain's folder.
- Import the database backup into the new database.
- Edit the copy's
wp-config.phpso the database name, user and password match the new database. - Add the two lines below to the same file so the copy uses its own address instead of sending you to the live site.
- Log in to the copy. Open a few pages, check that images load and confirm the newest post or order is there.
define( 'WP_HOME', 'https://test.example.com' );
define( 'WP_SITEURL', 'https://test.example.com' );Note what went wrong and repeat the test after you change host or backup plugin. When you finish, delete the test copy and its database.
Troubleshooting
- The cPanel backup fails or the file is incomplete. cPanel warns that the backup process can fail on an account near or over its disk quota. Free some space and run the backup again.
- The phpMyAdmin export or import stops partway. The database is too large for the browser route. Use
mysqldumpandmysqlover SSH, or the cPanel database backup. - The site shows a database connection error after a restore. The details in
wp-config.phpdo not match the database. Correct the name, user and password. - You have only a full cPanel backup. Ask your host to restore it, or extract the
.tar.gzfile, take thepublic_htmlfolder from itshomedirfolder and upload the files with File Manager.
Backups are one part of a wider routine. The WordPress security checklist covers updates, logins and file permissions, and WaseerHost has a website security page for the hosting side. If you are restoring onto a new host because you are leaving the old one, WaseerHost offers free website migration.
Frequently asked questions
Copy the files and export the database. In cPanel, open Backup and download the home directory and your WordPress database under Partial Backups. Without that page, use File Manager and phpMyAdmin.

Written by
Founder & CEO
Founder and CEO of Wasevo LLC, the company that runs WaseerHost. He works on cPanel/WHM servers, WHMCS billing and the Next.js storefront.


