BlogMigrations

How to Export a WordPress Database: 4 Methods That Work!

Akshat ChoudharyAkshat ChoudharyUpdated November 12, 2026 · 13 min read

feature image

Need a copy of your database before a plugin update? Moving to a new host? You can export a WordPress database as an SQL file, then use that file to restore or move your site’s data.

The steps are fairly short. The part that needs care is choosing the right database, keeping all the tables you need, and checking that the file works before you rely on it.

This guide covers four ways to do that, from a few clicks in your hosting panel to commands you can run over SSH. Pick the method that fits the access you have.

TL;DR: To export a WordPress database, open your database in phpMyAdmin, choose Export → Quick → SQL, and download the file. You can also use a backup plugin, WP-CLI, or mysqldump. Keep the export outside your public site folder and test it on a separate database. A database export doesn’t include your images, plugins, or theme files.

Which export method should you use?

You don’t need to try all four. Start with the tool you can access.

Method When it helps What you need
phpMyAdmin A one-off export through your hosting panel Hosting or database access
BlogVault Downloading the database from a saved backup A completed BlogVault backup
WP-CLI Large databases or repeat exports SSH access, WP-CLI, and the dump utility it uses
mysqldump A direct export without WP-CLI Terminal access, mysqldump, and database credentials

If your WordPress dashboard won’t load, phpMyAdmin or a command-line export may still work. If your host provides a different database manager, check whether it has an SQL export feature.

Only need to move a few posts? WordPress’s Tools → Export screen may be enough. That creates a content export in XML format, though not a full database copy.

What does a WordPress database export include?

An SQL export holds the instructions needed to recreate your database tables and their data. That usually includes:

WordPress database tables listed for export
  • Posts, pages, comments, and custom post types.
  • Users, email addresses, password hashes, and user roles.
  • Site settings, categories, tags, and custom fields.
  • Plugin data stored in the database, including order data where applicable.
  • Media records, such as attachment details and image alt text.

It doesn’t include the actual images in your uploads folder. Nor does it include plugin code, theme files, WordPress core, or wp-config.php.

For a full site restore, you need the database and the matching site files. Keep them together when you back up your WordPress site. Having the posts but losing the photos is a rough way to discover the difference.

Before you start, check the database name

A hosting account can contain several databases. Your live site, an old install, and a staging copy may all have similar names.

To find the right one, open your site’s wp-config.php through your host’s file manager or SFTP. Look for:

Code
define( 'DB_NAME', 'your_database_name' );

Match that value to the database you export. Also note the table prefix:

Code
$table_prefix = 'wp_';

Your prefix may be different. Don’t change either value while checking it, and don’t share the file: it also contains database credentials.

For a complete backup, include all tables that belong to the site, including tables added by plugins. If several sites share one database, check table ownership before selecting everything.

Using multisite? A whole-network export needs both the shared tables and each subsite’s tables. Copying one subsite out of a network takes extra work; a few selected tables won’t create a standalone site.

Method 1: Export a WordPress database with phpMyAdmin

phpMyAdmin lets you manage a database in your browser. Many hosts provide it through their control panel, so there’s no plugin to install.

phpMyAdmin database management interface
  1. Sign in to your hosting panel. Find the database section and open phpMyAdmin. Some hosts sign you in automatically; others require database credentials.
  2. Select your site’s database. Use the name you found in wp-config.php. You should see its tables in the main panel.
  3. Open the Export tab. Do this from the database view, rather than an individual table.
  4. Choose Quick and SQL. On a standard setup, this exports the selected database’s tables with their structure and data.
  5. Click Export or Go. Save the downloaded SQL file somewhere private on your computer.

That’s enough for many small sites. If you need more control, choose Custom and review these settings:

phpMyAdmin export settings for a WordPress database
Setting What to choose
Tables All tables required by your site
Output Save output to a file
Format SQL
Structure and data Include both
Compression gzip if you want a smaller download and your setup supports it

You may also see Add DROP TABLE statements. These tell an import to delete matching destination tables before recreating them. They can help when replacing an existing copy, but they can also erase data. An empty test database is a safer place to check your export.

Export button in phpMyAdmin

If the export keeps timing out, try WP-CLI, mysqldump, or your host’s backup tool. Compression reduces download size, but it doesn’t remove server time limits.

For a closer look at the screens, see our phpMyAdmin database backup guide.

Method 2: Download a database backup

With BlogVault, you download the database from a completed backup. This is useful when you need an earlier copy, such as the version from before a plugin update.

BlogVault backup details with database download options
  1. Open your site in the BlogVault dashboard.
  2. Go to Backups and open View Backup History.
  3. Find the backup date you need and choose its download action. Check the date and time before you continue.
  4. Choose the database components. Exclude files if you only need the database, and include every table required for the backup.
  5. Review your selection and start the download process. When the package is ready, download it to your computer.

The BlogVault download guide shows the current workflow.

The download contains data from that backup, not changes made since it ran. If you need a fresh copy, run a new backup and wait for it to finish first.

Keep the full backup too. A database-only download is useful for a specific task, while the full copy gives you the files you’ll need for a complete restore.

Method 3: Export with WP-CLI

WP-CLI lets you run WordPress tasks from a terminal. It’s a useful choice when browser exports fail, or you want a repeatable command.

Connect to the server using the SSH details supplied by your host, then go to your WordPress directory:

Code
cd /path/to/wordpress

Export the database to an existing private folder outside the web root:

Code
wp db export /private/backup/site-database.sql

Replace both paths with real paths on your server. The destination folder must exist and be writable by your account.

WP-CLI reads the connection details from wp-config.php and runs the database dump utility. By default, it exports every table in that database, including tables that don’t use your WordPress prefix. Check this if the database is shared.

For a database whose tables all use InnoDB, you can request a consistent snapshot without holding table locks for the whole export:

Code
wp db export /private/backup/site-database.sql --single-transaction --quick

Here, --quick means rows are read as a stream, which helps limit memory use. It isn’t the same setting as Quick in phpMyAdmin.

Once the command finishes, check for errors and download the file through SFTP. A path in this command refers to the server you’re connected to, not your laptop.

Don’t confuse wp db export with wp export. The first creates an SQL database dump. The second creates a WordPress content export.

Method 4: Export directly with mysqldump

No WP-CLI? You can use mysqldump directly if it’s installed and your account can connect to the database.

Get DB_HOST, DB_USER, and DB_NAME from wp-config.php, then run:

Code
mysqldump --host=DB_HOST --user=DB_USER --password \
  --single-transaction --quick --no-tablespaces \
  --result-file=/private/backup/site-database.sql DB_NAME

Replace the uppercase placeholders and output path with your own values. If your host gives you a separate port or socket, use its connection instructions rather than copying the full WordPress DB_HOST value unchanged.

The command prompts for your password. Leaving it out of the command itself keeps it out of your shell history.

Here’s what the other flags do:

  • --single-transaction requests a consistent snapshot for InnoDB tables. It doesn’t provide the same protection for nontransactional tables such as MyISAM.
  • --quick streams rows instead of loading a whole table into memory.
  • --no-tablespaces skips tablespace information, which avoids a common privilege error on shared hosting. Other permission errors may still need your host’s help.
  • --result-file writes straight to a file and avoids shell redirection encoding issues on Windows.

Avoid changes to table structure during a snapshot export. That includes plugin updates that alter tables. If your site uses mixed storage engines, ask your host how to take a consistent backup.

On some MariaDB servers, the matching tool is mariadb-dump. Use the client and instructions your host supports.

Check the export before you need it

A file appearing in your downloads folder is a good start. It isn’t a restore test.

First, check the basics:

  • Did the tool report an error? A failed command can still leave a partial file behind.
  • Is the file empty or much smaller than expected? Compare it with an earlier export if you have one. Compressed and plain SQL sizes won’t match.
  • Does it contain table structure and data? A normal full SQL dump should contain statements such as CREATE TABLE and, for populated tables, INSERT INTO.
  • Does it belong to your site? Check a familiar table name or site URL locally. Don’t upload the dump to an online checker.

A typical mysqldump file includes a completion comment near the end, unless those comments were disabled. It’s a useful clue, but it doesn’t prove every required table was selected.

For a gzip file, you can also check the compressed archive:

Code
gzip -t /private/backup/site-database.sql.gz

No error means gzip found no archive integrity problem. It doesn’t confirm that the SQL inside is complete.

Then test an import on a separate copy

Use an isolated local site or staging environment with a separate database. Never run a test import against your live site’s database.

BlogVault staging environment for testing a backup
  1. Create an empty test database and a separate copy of the site files.
  2. Configure that copy’s wp-config.php to use the test database. Confirm its database name and host before importing.
  3. Use phpMyAdmin’s Import tab, or run this command from the test site’s WordPress directory:
Code
wp db import /private/backup/site-database.sql

Extract compressed downloads first if the import tool requires it. An import can delete or replace existing tables depending on the SQL file.

Before browsing the copy, update its URLs if needed and disable outgoing email, live payments, webhooks, and scheduled integrations. Keep the test site private too.

Then check a few posts, a user account, key settings, and any plugin data your site relies on. For a store, check known orders and their details. A site that loads its homepage can still be missing important data.

Moving the database? Watch these three details

Once you have a checked export, you can use it for a WordPress site migration. The destination still needs the matching files and the correct database settings.

A new domain needs careful URL changes

WordPress and plugins can store URLs inside serialized data: values whose format includes string lengths. A plain text replacement can break that format.

On the destination copy of a standard single-site install, preview a replacement with WP-CLI:

Code
wp search-replace 'https://old.example.com' 'https://new.example.com' \
  --all-tables-with-prefix --skip-columns=guid --dry-run

Review the affected tables and replacement count. Then run the same command without --dry-run to apply it. WP-CLI handles serialized data; --skip-columns=guid preserves existing content identifiers.

Multisite migrations need a network-specific plan for domains, paths, and shared tables. Don’t apply this single-site example blindly.

A busy store keeps changing after the export

An InnoDB snapshot captures a point in time. Orders, payments, and sign-ups made after that point won’t appear in it.

For a backup, make sure that gap fits your recovery needs. For a move, arrange a final sync or a controlled pause in writes before switching traffic. Exporting at a quiet hour reduces activity; it doesn’t stop new orders.

The destination database must support the dump

An import into an older MySQL or MariaDB version may fail with an unknown collation error, such as utf8mb4_0900_ai_ci.

Ask your host to check compatibility first. Replacing a collation name throughout the dump isn’t a universal fix: collations affect how text is compared and sorted. Keep the original export untouched while you resolve the issue.

Keep the SQL file private

Your dump can hold customer details, email addresses, password hashes, and sensitive plugin settings. Treat it like private site data.

Store it outside public folders such as public_html, download a copy off the original server, and restrict access. Use encrypted storage for sensitive exports. Give the file a clear site name and date, then remove temporary server copies when you’re done.

If you suspect a hack, keep any new export separate from known-clean backups. A database dump can contain malicious settings, injected content, or unwanted users. It preserves the current state; it doesn’t clean it.

FAQs

Can I export a WordPress database from wp-admin?

You can use a backup plugin that supports database downloads. WordPress’s built-in Tools → Export screen creates a content XML file, not a complete SQL database backup.

Does a WordPress database export include images?

No. It includes media records, but the actual files usually live in wp-content/uploads. Back up the uploads folder too, or export the full WordPress site.

Can I export a WordPress database without phpMyAdmin?

Yes. Use WP-CLI, mysqldump, a backup plugin such as BlogVault, or your host’s database export tool. The right method depends on the access your host provides.

Can I export the database through FTP?

FTP and SFTP transfer files. They don’t create a database dump. You can use SFTP to download an SQL file after another tool creates it, but copying the WordPress folder alone won’t back up the database.

Can I export a WordPress database to CSV?

phpMyAdmin supports CSV exports for table data. That’s useful for spreadsheet work, but it doesn’t preserve everything needed to recreate a WordPress database. Use SQL for backups and migrations.

Will exporting the database change my site?

A normal export reads data without changing its contents. It can still use server resources, and some methods hold locks that delay writes. For a busy site, choose a suitable backup method and timing with your host.

Do I need a manual export if I have automatic backups?

Not for every routine task. A fresh manual export can be useful before database work or when someone needs an SQL copy. Check that your automatic backups include the required tables and files, and test a restore rather than relying on backup status alone.

Before you close that tab

Choose the method you can access, export the right database, and test it on a separate copy. Keep the matching site files alongside it if you may need a full restore.

Once you’ve done that, you have more than a downloaded file. You have a copy you’ve checked—and a much calmer starting point for the next update or move.

Written by
Akshat Choudhary
Akshat Choudhary

Akshat is the founder and CEO of BlogVault, MalCare, and WP Remote.

Backups built for scale. Restores for the bad day.

No credit card · 14-day money-back guarantee

© 2026 BlogVaultWhatever breaks, you'll get it all back.