The short answer: pick the restore route that matches your host and file, work on a copy when you can, and import the backup only after you know what the backup contains and how the current database was created. Restoring a WordPress database means importing a .sql dump (often gzipped) into MySQL or MariaDB and repointing WordPress at it — that brings back posts, pages, comments, users, and settings, but not themes, plugins, uploads, or wp-config.php. The method changes based on whether you have phpMyAdmin, WP-CLI plus SSH, a host panel, or a plugin; the success check is the same everywhere: the site loads and the table prefix matches what wp-config.php expects.

What follows assumes you have a real backup file and a working database server. If the site is live, also read the preparation section carefully — a restore replaces the current database state, and that is not reversible unless you save a copy first.

What a database backup actually contains, and what it leaves out

A WordPress database is a set of tables that share a prefix, usually wp_. The default install creates tables such as wp_posts, wp_postmeta, wp_options, wp_users, wp_usermeta, wp_terms, wp_term_taxonomy, wp_term_relationships, wp_comments, and wp_commentmeta. Some plugins add their own tables under the same prefix; some use the prefix but with custom names. Those tables hold your text content, metadata, menus, settings, user accounts, and comment threads.

What the database does not hold is just as important. Your theme files, plugin code, media uploads in wp-content/uploads, and the wp-config.php file live in the filesystem, not the database. That has two practical consequences. First, a database-only restore can leave a site broken if the code files and the database no longer agree — for example, restoring a backup from before a plugin update while the updated plugin files are still on disk. Second, a broken site after a successful import often turns out to be a missing or mismatched code file rather than a database problem.

The official WordPress documentation states this limitation plainly: the steps back up the WordPress database but not the WordPress files, and a full-site restore requires a separate file backup. If you only have a database dump and the code directory was also lost, restore the files separately before or right after the database, and match their versions to the backup date as closely as you can.

Export formats matter too. phpMyAdmin and WP-CLI produce plain SQL statements (CREATE TABLE, INSERT), commonly compressed as .sql.gz. Host panels like cPanel's MySQL backup download a .gz file that you upload back unchanged — there is no need to decompress it first. A file that has been run through an unusual extractor or had its header stripped may fail to import with syntax errors, which is why keeping the original archive untouched is the safer habit.

Before you touch anything: prerequisites and the safety copy

Every restore path below needs four things in place before the first step.

Access. A database administration tool (phpMyAdmin, Adminer, or a host's database panel), or SSH with WP-CLI, or the host's own backup interface. Know which one your host provides; typical shared hosts offer phpMyAdmin through cPanel or a custom dashboard, while managed WordPress hosts usually expose a one-click restore.

The backup file itself. Confirm its date, size, and format. A backup from three days ago and one from three years ago are very different restore targets. If the file is zero bytes or suspiciously small, stop and find another copy.

Credentials. The database name, user, password, and host from wp-config.php (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST) plus the table prefix ($table_prefix). You will need these to repoint WordPress if the restored database lands under a different name or prefix.

A current-state snapshot. Before importing, export the existing database even if it looks broken. That export is your only undo. If the site has been active, the live database may contain content written after the backup; exporting it first preserves the option to extract that content later, though merging is manual work.

One more decision: restore in place or restore to a copy? In-place is faster and is the normal choice when the site is down and the backup is your only copy. Restoring to a staging copy first lets you confirm the backup is intact and the site works before you overwrite production. Many hosts include staging tools; if yours doesn't, you can create a second database and a second WordPress install pointed at it. The cost is time and a little disk space; the benefit is that a bad backup fails harmlessly.

The step-by-step restore paths

The order below moves from simplest and most common to more manual. Pick one path, not all of them — doing two imports over the same database will produce duplicate-table errors or a half-merged state.

Path A: Host panel or one-click restore

Prerequisites: a host that provides scheduled backups and a restore button, and a confirmed backup date. This is the least error-prone route and the one to prefer when available.

1: Log in to your host's control panel and find the backup or restore area. 2: Locate the backup whose timestamp matches the state you want and note exactly what it covers — database only, files only, or full site. 3: Trigger the restore and wait for the completion message. Do not close the browser tab mid-restore. 4: Open the site in a private window and check the front page, a recent post, and the admin login. 5: If the host restored only the database, verify that files are from a compatible date.

A cPanel-style flow is similar but more manual: the panel offers "Download a MySQL Database Backup" per database as a .gz file, and restoring means uploading that same file back through the same interface. The upload completes when the panel reports the dump finished — a truncated upload is the usual cause of a "restore seemed to work but tables are missing" outcome. If you are moving to a new host, recreate the database user and matching password, and if the password differs from the old one, edit wp-config.php accordingly.

Success check: the panel shows the database present, and the site's admin area loads without a "database connection" error.

Path B: phpMyAdmin import

Prerequisites: phpMyAdmin access, the database selected, and a backup file in .sql or .sql.gz form. The official restore instructions describe this as the standard manual method. The documented sequence was tested against phpMyAdmin 4.4.13 with MySQL 5.6.28, so very old or very new versions can rearrange buttons, but the Import tab has been stable for years.

1: Log in to phpMyAdmin. 2: Click Databases and select the database you will import into. If you are restoring into a brand-new, empty database, that's fine — a clean target is actually the easiest case. 3: On the database screen, click the Import tab. 4: Use Browse to locate the backup file on your computer, or paste SQL into the text box only if the file is tiny. 5: Check the character set option. If the backup was made from a UTF-8 site, UTF-8 is right; a mismatch is the usual cause of mangled accented characters and emoji after import. 6: Leave compression detection to phpMyAdmin if it recognizes .gz; otherwise decompress and import the .sql file. 7: Click Go and wait. For large files, the import can time out — that's a PHP and web-server limit, not a corrupt backup. 8: After completion, click Structure and confirm the expected tables are listed with roughly the right row counts.

If the target database already contains tables and the backup includes CREATE TABLE statements without DROP TABLE IF EXISTS, the import fails partway with "table already exists" errors. Two clean options: empty the target first (select all tables, drop them), or import into a fresh, empty database and repoint WordPress. Dropping tables is destructive, so export the current state first as described above.

Large-file failure is common enough to plan for. phpMyAdmin is limited by upload_max_filesize, post_max_size, and script execution time. Workarounds: import a compressed file so the upload is smaller, raise the limits if the host allows it, split the dump into per-table files, or use Path C or D, which don't go through the browser's upload limits.

Path C: WP-CLI over SSH

Prerequisites: SSH access, WP-CLI installed, and the site's wp-config.php reachable so WP-CLI can find the database. This is the most reliable route for large databases and the easiest to script.

1: Connect over SSH and change to the WordPress root directory (the one containing wp-config.php). 2: Check WP-CLI works: run wp core version. If it reports the version, WP-CLI is reading the config correctly. 3: Import the dump: wp db import backup.sql for a plain file, or point it at the .sql file after decompressing a .gz archive with gunzip. WP-CLI's importer streams the file, so browser limits don't apply. 4: If the import targets a database that isn't the one in wp-config.php, pass --dbname, --dbuser, and related flags, or import first and edit the config afterward. 5: Flush caches so WordPress doesn't serve stale options: wp cache flush. On sites with a persistent object cache, also clear that cache service. 6: If you changed the site URL or domain, update it with wp search-replace 'old.example.com' 'new.example.com' — but run that only after the data is in place and only with a dry run first (--dry-run) to see the affected row count.

Success check: wp db check reports the tables are OK, and wp option get siteurl returns the expected address.

Path D: Restoring into a new database and repointing WordPress

This is the cleanest option when the old database is damaged, locked, or full, and it avoids dropping tables. It's also the right approach on a new server.

1: Create a new, empty database and a user with full privileges on it. 2: Import the backup into the new database using Path B or C. 3: Edit wp-config.php: set DB_NAME, DB_USER, and DB_PASSWORD to the new values. Leave $table_prefix as it was in the backup — if the old site used wp_, keep wp_; changing it without renaming tables in the dump breaks the site. 4: Load the site. If it redirects to the old domain, the siteurl and home options in wp_options still point there; update them with WP-CLI's wp option update or a careful search-replace. 5: Recheck permalinks by visiting Settings > Permalinks and saving once, which rewrites the rules.

Success check: the dashboard loads, the posts list shows the right number of posts, and a test comment or post submission works.

The manual command-line route for MySQL and MariaDB

The underlying operation all four paths perform is a single import: the dump is a text file of SQL statements, and the database server executes it. If you have direct server access, the classic commands are:

mysql -u user -p dbname < backup.sql imports a plain dump. zcat backup.sql.gz | mysql -u user -p dbname imports a gzipped dump without creating a temporary file. mysqldump -u user -p dbname > backup.sql creates the reverse — your pre-restore snapshot.

Graphical clients do the same job: MySQL Workbench's Data Import/Restore panel lets you point at a dump folder or file and click Start Import. The WordPress documentation mentions this route alongside phpMyAdmin, and it is a reasonable choice if you already use Workbench for other database work.

Every command-line import wants an empty or intentionally chosen target. If the dump contains DROP TABLE IF EXISTS statements, it will replace existing tables as it goes; if it doesn't, conflicts stop the import partway. Treat a partially completed import as a failed one: the database is now a mix of old and new data. The fix is to empty the target and run the import again from the untouched backup file.

Verify the restore and fix the usual following problems

Verification should cover more than the front page. Check these in order:

1: The site loads. A "Error establishing a database connection" message means the credentials in wp-config.php don't match the database — recheck host, name, user, and password. 2: The admin loads. A login redirect loop or a white screen usually points to options in wp_options — often a stale siteurl — or a plugin mismatch. 3: Content is present and correct. Open a handful of posts, including one with images and one with special characters. Mangled characters mean a character-set mismatch during import; fixable by re-importing with the correct set if the backup file is intact. 4: Users can log in. A "your password is incorrect" response for every account is a different symptom than a broken database — check the wp_users table for the accounts you expect. 5: Tables are complete. Missing tables named after a plugin mean the backup predates that plugin, so the files on disk and the database are out of sync. Reactivate or remove the plugin as appropriate.

A restore that completes but shows an empty site usually means the import went into the wrong database or the wrong table prefix. wp db tables or phpMyAdmin's Structure view settles that quickly. Some hosts also cache pages aggressively; if the admin shows correct content and the public site shows old content, purge the host and plugin caches before assuming the restore failed.

Choosing the right method for your situation

The decision comes down to access and file size more than preference.

Situation Best path Why
Managed host with scheduled backups Host one-click restore Handles files and database together; no manual import
Shared host, phpMyAdmin, small dump (under roughly the upload limit) phpMyAdmin import No SSH needed; import tab is standard
Large dump or SSH available WP-CLI wp db import Streams the file; not limited by browser upload settings
Old database corrupted or locked New database plus wp-config.php edit Avoids dropping tables in a damaged database
Migration to a new server New database, import, update siteurl and home Clean target; domain change handled explicitly

The limits matter. phpMyAdmin fails on large files not because the file is bad but because the web server refuses large uploads and long-running requests. A one-click host restore may not let you pick an arbitrary date or may overwrite files you wanted to keep. WP-CLI requires SSH, which some hosts don't offer. The new-database path takes a few more minutes but leaves the old database untouched, which is the safest choice when you're unsure the backup is good.

If you restore an old database against newer plugin files, expect plugin-specific problems rather than WordPress-wide ones: a plugin may report missing tables or refuse to load. The reverse — new database, old files — can also fail if a plugin stored data in a format its older code doesn't recognize. Matching the file backup date to the database backup date, or at least keeping the gap small, prevents most of this class of trouble.

Edge cases: multisite, changed domains, and partial backups

Multisite. A multisite network stores per-site tables named like wp_2_posts and network-wide tables like wp_blogs and wp_site. A single-site dump restored into a multisite install, or the reverse, will not work. Import the full network dump and keep wp-config.php's MULTISITE and DOMAIN_CURRENT_SITE settings consistent with it. Search-replace on a multisite database needs the network-wide tables included, which WP-CLI's search-replace handles when pointed at the right scope.

Domain changes. Restoring on a new domain leaves old URLs in the database — in siteurl, home, post content, and widget settings. Updating wp_options alone fixes navigation; content links need a search-replace. Run it with a dry run and a fresh snapshot, because a careless replace on serialized data can corrupt option values. WP-CLI's wp search-replace is built to handle serialization correctly; raw SQL UPDATE ... REPLACE is not, and is the most common cause of a site that loads but looks scrambled.

Partial backups. Some plugin backups include only posts and options, not users. Restoring such a file over a live database can delete user accounts if the dump includes DROP TABLE statements. Read the header of the .sql file before importing: the table list tells you exactly what will be replaced.

Backup file won't import. Distinguish symptoms from causes. A syntax error near line 1 suggests the file is corrupted or was truncated during download. "Access denied" is a credentials problem, not a file problem. "Table already exists" means the target wasn't empty. Timeout means the size limit issue described above. Each has a different fix, and none of them is "try the same import again unchanged."

Stop conditions: if the host's restore completes and the database still reports corruption, if wp db check returns errors that persist after a clean re-import, or if the backup file itself fails to parse after being downloaded twice, the underlying problem may be server-level — disk, MySQL configuration, or a damaged backup. At that point, contact the host's support or a qualified database administrator rather than layering more imports over a database in an unknown state. Rewriting a dump by hand to work around a parse error is risky for anyone without SQL experience.

The routine that prevents most of this work is unglamorous: export the database before every plugin or core update, keep the file and the matching file backup together as one set with a date in the name, and confirm the export is nonempty and downloadable. The restore steps above are the recovery plan you hope never to need — and on the day you do need them, the safety copy you made first is what makes the whole process reversible.