A WordPress database backup restores by importing its SQL dump into your site's existing MySQL or MariaDB database, either through phpMyAdmin, a host control panel, WP-CLI, or a backup plugin's restore function. The file must match your site's table prefix and contain complete table structures; otherwise the import either fails or leaves the site pointing at missing content. Before touching anything, confirm you have both the database export and a current backup of the live database, because the import overwrites what's there. The steps below assume a typical self-hosted site; managed hosts like WordPress.com impose different rules, covered later.

A database backup holds posts, pages, comments, users, settings, and plugin configuration data. It does not hold theme files, plugins, uploads, or wp-config.php, so a "full restore" usually means restoring the database and the matching wp-content files together. If you restore only the database against a different set of files, plugin tables may reference code that isn't installed, and serialized settings may point at image paths that no longer exist.

What's actually inside the backup file, and what has to match

A .sql file is a sequence of statements: CREATE TABLE definitions followed by INSERT rows. A .sql.gz or .bz2 file is the same content compressed. cPanel's "Download a MySQL Database Backup" produces a gzipped dump that can be re-uploaded without unzipping, while phpMyAdmin's export can produce either compressed or plain SQL depending on the format you chose.

Three things must line up for a clean restore:

The table prefix. WordPress tables are named wp_posts, wp_options, and so on by default, but many installs use a custom prefix for security or because multiple sites share one database. The prefix lives in wp-config.php as $table_prefix. If the backup says wp_ and your config says wpxy_, the import creates parallel tables the site never reads.

The site URL values. The siteurl and home rows in wp_options control where WordPress thinks it lives. Restoring a backup from example.com onto staging.example.com without updating those rows produces redirect loops or a site that loads assets from the wrong domain.

The database user's privileges. Import needs CREATE, INSERT, DROP (to replace existing tables), and ALTER where relevant. Some hosts grant only SELECT, INSERT, and UPDATE to the WordPress user, which is enough to run the site but not to restore it.

One more compatibility check: a dump created on MySQL 8 may contain collations or syntax that an older MariaDB server rejects, and a very old dump may lack statements newer MySQL versions expect. These mismatches surface as import errors rather than silent corruption, so watch the output rather than assuming success.

Prerequisites before you import anything

Gather these before starting, because a half-finished restore is worse than no restore:

The database backup file, and its creation date. You want the most recent one that predates the problem. A fresh export of the current database, even if it's broken. This is your undo button and costs a minute. Direct access to your host's control panel (cPanel, Plesk, or similar) or phpMyAdmin credentials, plus SFTP or SSH if you'll be handling files. The $table_prefix value from wp-config.php, readable through your host's file manager or SFTP. A maintenance window. Put the site into maintenance mode (wp maintenance-mode activate with WP-CLI, or a temporary .maintenance file in the WordPress root) so visitors don't write new posts or orders into a database that's mid-restore.

If you're on managed WordPress hosting with a one-click restore in the dashboard, use that instead. Manual import is the fallback for when the plugin or host tool is unavailable, the backup came from elsewhere, or you need surgical control over which tables are replaced.

Restore path one: phpMyAdmin import

This is the most portable method and works on nearly every shared host.

1: Log into phpMyAdmin and select the WordPress database in the left panel. Confirm the table list matches your live site, which tells you you're in the right database. 2: Export the current state first: choose Export, pick the SQL format, and save the file locally. This is the undo copy. 3: Drop or rename the existing tables. The WordPress handbook notes that the simple restore method expects the target database to have no tables, so select all tables, choose Drop, and confirm. If you'd rather not destroy them, rename each table with a temporary suffix instead, though this is tedious on a large install. 4: Choose Import, select your backup file, and set the character set to match the dump (usually utf8 or utf8mb4). Leave "allow the interruption of an import" enabled on large files so the browser doesn't time out. 5: Run the import and read the result message. A successful import reports the number of queries executed. Any red error line means the restore is incomplete; note the table name and error text before retrying.

If your host caps upload size below your dump's size, compress the file to .sql.gz, which phpMyAdmin accepts and which usually fits. If it still won't fit, the import has to go through the command line.

Check success by loading the site and logging into wp-admin. You should see posts from the backup's date, your usual plugins, and the correct site URL in Settings, General.

Restore path two: cPanel upload or the command line

cPanel's backup tool is the shortest route on hosts that offer it. Find "Download a MySQL Database Backup" in the backups section, click the database name, and you get a .gz file. To restore, use the same panel's restore/upload option for that database and upload the file; the browser reports "dump complete" when finished. Per the WordPress documentation, there's no need to unzip it first. Note that cPanel's full-account backups are archival and can't be restored through this tool, so don't generate one expecting to upload it back.

On a VPS or anywhere with SSH, the command line is faster and more reliable for large databases:

or for a plain SQL file:

Dropping and recreating the database first gives the cleanest result, since the dump will then build every table fresh. If the dump includes CREATE DATABASE and USE statements, it will switch databases on its own. Watch for errors printed to the terminal; mysql exits nonzero on failure, so check the exit status. A quiet return to the prompt with no output is the success signal.

If you're restoring into a database with a different name than the backup expects, plain-SQL dumps without USE statements import fine into the database you specify on the command line. Dumps that name a database need that section edited out or the target database renamed to match.

Restore path three: WP-CLI and plugin restore

WP-CLI handles the import without a browser:

This uses the credentials in wp-config.php, so it fails if your WordPress database user lacks import privileges, which is a common cause of "the import didn't work" on locked-down hosts. wp db export before importing gives you a matching backup made the same way. wp db check afterward verifies table integrity, and wp option get siteurl confirms the URL survived.

Backup plugins that store their own archives typically offer a restore button that handles the import and rewrites URLs for you. Kinsta's guide notes that plugins often let you back up only the uploads directory and database to save space, and the restore path reflects that scope: if your archive lacks the themes and plugins folders, you reinstall those separately. Plugin restores also sometimes need the plugin's own database tables, which live in the same database and come back with the rest. A plugin restore is the right choice when the backup was made by that plugin; a manual import is the right choice when it wasn't.

After the import: fix the things a raw dump won't fix

A restored database frequently lands on a site that throws errors or redirects. These are the usual causes, in order of how often they appear.

The table prefix mismatch. Open wp-config.php and compare $table_prefix with the actual table names you see in phpMyAdmin. If they differ, either rename the tables to the config's prefix or change the config to match the backup. Renaming is safer if other tooling expects the original names.

The site URL. Restoring a backup from a different domain leaves siteurl and home pointing at the old address. Fix it in phpMyAdmin by editing those two rows in the options table, or from the command line with wp option update siteurl "" and the same for home. Changing only these two rows fixes navigation and login; embedded links inside post content and widget settings still point at the old domain and need a search-replace.

The search-replace. WordPress stores some settings serialized, with string lengths embedded in the data, so a naive find-and-replace corrupts them. Use wp search-replace 'old.example.com' 'new.example.com' --all-tables --precise or a serialization-aware tool. Take a fresh export before running it, because a wrong replacement is hard to reverse.

Users and logins. If the backup included the users table, your old password and accounts work. Some restore guides strip the users and usermeta tables before import so a host's single sign-on or Jetpack connection survives; if you follow that route, you'll need to reset your password or recreate the admin account afterward. Restoring the users table wholesale also overwrites any passwords changed since the backup was taken.

Missing files. Images referenced by the database live in wp-content/uploads, and theme and plugin code lives in wp-content/themes and wp-content/plugins. Restore those from the file portion of your backup or reinstall the plugins and themes at the versions the database expects. A database restore with mismatched plugin versions can produce fatal errors from plugins expecting tables or options that don't exist.

WordPress.com and Jetpack backups work differently

On WordPress.com, manual restore requires an active Business or Commerce plan, per the platform's documentation. The flow retrieves a Jetpack .tar.gz or Studio .zip backup, enables SFTP, and unpacks the file to find sql and wp-content subfolders. The platform's guide then removes the wp_users and wp_usermeta tables from the SQL export before importing, specifically so the Jetpack connection doesn't break.

That step matters outside WordPress.com too: on any host where a connection plugin or host-level integration ties the site to an external account, overwriting the users tables can sever it. WordPress.com also notes that if your Business or Commerce plan recently expired, backups may still be restorable with one click, so try that before the manual route. This is one of the cases where the platform's own procedure overrides generic advice, because the generic advice would break the connection.

Verify the restore and know when to stop

Check these in order. Load the homepage and a deep post URL; both should render without database errors. Log into wp-admin. Open Settings, General and confirm both URLs. Visit Plugins and confirm active plugins match what the backup had. Check a few media items in the library, which tests whether the uploads folder and database agree. If the site sells anything, place a test order through a sandbox payment method rather than assuming checkout tables came back intact.

If the site shows "Error establishing a database connection," the credentials in wp-config.php no longer match a real database user. On a new host, recreating the database user and password and updating wp-config.php is expected; the WordPress documentation flags this specifically for restores to a new host. If tables import but the site shows a blank page, check the prefix and the PHP error log before doing anything else.

Stop and get host support involved when the import fails partway with a privilege or disk-space error, when the database is large enough that the browser times out repeatedly, or when the site runs on managed infrastructure where direct database access isn't offered. Continuing to retry a partial import can leave a mixture of old and new tables that's harder to untangle than the original problem.

A final safeguard worth building into your routine: schedule database backups before every plugin or core update, not just monthly, and keep the export alongside the matching wp-content files so a restore is one operation rather than two half-matched ones.