How to Backup WordPress Site and Database?

What a Complete WordPress Backup Must Include

How To Backup WordPress Site And Database - SiteHale

A WordPress site lives in two separate places, and a backup that captures only one of them cannot restore your site. The files sit on your web server, usually inside the public_html folder. They include WordPress core files, your themes, your plugins, everything in wp-content/uploads, and the wp-config.php file that stores your database connection details. The database is a MySQL or MariaDB database. It holds every post, page, comment, user account, menu, widget setting, and plugin configuration.

Find your database name before you start. Open wp-config.php and look for the line define( ‘DB_NAME’, … ). Many hosts run several databases on one account, so this tells you which one belongs to your site. Also note the $table_prefix value, which defaults to wp_. Some security plugins change it, and you will need it to recognize your tables in phpMyAdmin.

For most small sites, the wp-content folder, wp-config.php, and the database are the critical pieces. You can download core WordPress files again from wordpress.org at any time. Custom code in .htaccess or the root directory is the exception, so include those files too if you have edited them.

Step-by-Step: Back Up Your Files and Database

  1. Export the database. In cPanel, go to Databases > phpMyAdmin and click your database name in the left sidebar. Open the Export tab, choose Quick as the method and SQL as the format, then click Go. If you have SSH access, run wp db export backup.sql from your site root instead. WP-CLI handles large databases without browser timeouts.
  2. Compress and download the site files. Open cPanel > Files > File Manager and right-click public_html. Choose Compress, select Zip Archive, and download the resulting .zip. You can also connect with FileZilla using your SFTP credentials and drag the folder to your computer.
  3. Install a backup plugin for automation. Go to Plugins > Add New, search for UpdraftPlus, then install and activate it. Open Settings > UpdraftPlus Backups > Settings.
  4. Set schedules and remote storage. Set the files backup to run weekly and the database backup to run daily, keeping 4–7 copies of each. Under Choose your remote storage, select Google Drive, Dropbox, or Amazon S3 and authorize the connection.
  5. Run the first backup. Return to the Backup / Restore tab, click Backup Now, and tick both database and files. Then confirm the archives appear in your remote storage account.

How to Verify Your Backup Actually Works

A backup file that won’t restore is worthless, and you will only find out it is broken during an emergency unless you test it first. Run these checks after your first backup and again every few months.

  • Inspect the SQL file. Open the .sql export in a text editor such as VS Code or Notepad++. Search for CREATE TABLE `wp_options` and CREATE TABLE `wp_posts`, using your own prefix. If the file stops abruptly or is only a few kilobytes for a site with hundreds of posts, the export timed out.
  • Check archive sizes. Compare the size of your wp-content/uploads folder in File Manager against the uploads archive. UpdraftPlus splits files into separate zips for plugins, themes, uploads, and others. A missing or tiny uploads zip usually means the process hit a server memory or execution-time limit.
  • Do a test restore. Install LocalWP on your computer and create a blank site. Install UpdraftPlus on it, upload your backup sets through Upload backup files, and click Restore. If your pages, images, and logins work locally, your backup is sound.

For manual backups, import the .sql file into a fresh database through phpMyAdmin’s Import tab. This confirms the file is valid.

Practical Tips for Reliable WordPress Backups

  • Follow the 3-2-1 rule. Keep three copies of your backup on two different types of storage, with one copy off-site. Host-provided backups sit on the same infrastructure as your site, so a server failure or account suspension can take out both. Pair your host’s snapshots with a cloud destination like Google Drive or S3, and download a quarterly copy to a local drive.
  • Back up manually before every major change. Plugin conflicts and PHP version upgrades are the most common causes of broken sites. WordPress core updates are another. Click Backup Now in UpdraftPlus right before updating, and label the backup so you can find it quickly. Scheduled backups may be up to a week old, which can mean lost orders or comments on an active site.
  • Exclude cache and backup folders. In UpdraftPlus settings, add cache, wp-content/updraft, and other plugins’ backup directories to the exclusion list. Including them bloats archive sizes and can cause timeouts. It can also nest old backups inside new ones.
  • Protect your backup files. Your archives contain wp-config.php, which holds your database password and security salts. Never leave .zip or .sql files in public_html, where anyone who guesses the filename can download them.

Does Your Site Have This Problem?

Every check in this article runs automatically on the sites we look after. You can run the same health checks on your own site in seconds with the free SiteHale plugin — no account, nothing transmitted anywhere. Or have us do it: we’ll crawl your site and send you a written report, free.

Get My Free Site Report

Proven on our own sites first

Every automation runs on our own sites before any client site

25+ years in IT

Built by a 25-year professional IT team

$49/mo flat

Everything included — no tiers, no upsells

Leave a Comment