Table of Contents

A WordPress database migration moves a MySQL or MariaDB database from one environment to another, between localhost and a production server, from one host to another, or across domain names. Whether the task is called a WordPress database migration or a WordPress data migration, the operation is the same: relocate the database that holds every post, page, user record, plugin setting, and theme option the site depends on.
The migration follows a consistent process: define the scope, prepare the source and target, select a transfer method, execute the move, verify the result, and cut over DNS to the new location.
Backup, optimization, and repair address a different lifecycle need. A WordPress database migration involves moving the database from point A to point B while preserving its data. Full-site migration, which bundles files, themes, and plugins along with the database, is a separate undertaking that also includes non-database assets.
A WordPress database migration is a relocation procedure that transfers the contents of a WordPress MySQL or MariaDB database from one environment, host, or domain to another while preserving every row of data. The procedure touches only the database layer, including tables, rows, serialized values, and the connections between them.
Five methods carry out the relocation:
WordPress database migration differs from three related but distinct operations:
The term “WordPress data migration” appears in some documentation as a synonym. Both phrases describe the same relocation procedure and can be used interchangeably where the phrasing fits naturally.
One disambiguation demands attention. “Migration” in the WordPress ecosystem can also refer to Laravel-style schema migrations, version-controlled PHP classes that alter database structure through frameworks like Radicle and Acorn, executed via wp acorn migrate. That sense of the word describes the structural evolution of a database schema, not the relocation of data between environments. Kinsta maintains a reference covering that workflow.
From this point forward, every use of “migration” refers to the relocation of WordPress database between environments, not schema evolution.
A WordPress database migration requires groundwork before any data leaves the source server. Skipping preparation creates problems that surface only after import, including version mismatches, character corruption, and broken table references, when diagnosing them is slowest and most disruptive.
Four prerequisites anchor the checklist:
A WordPress database migration is necessary in four recognizable scenarios, each defined by the relationship between the source and target environments. Knowing when to migrate a database, when to migrate db from one host or domain to another, starts with matching the situation to one of these patterns.
Moving from localhost to a live server is the most common trigger during development. A WordPress database built on a local machine (MAMP, XAMPP, Local by Flywheel, or Docker) needs to be deployed to a production host where visitors can access it. Every URL stored in the database still points to localhost or 127.0.0.1, which means the migration must handle URL rewriting before the site can function in the public domain.
Promoting a staging database to production follows a similar pattern. A staging environment lets content editors and developers validate changes against a copy of the live database. Once validated, the staged database replaces the production database. The source and target may share the same host but occupy different database instances, so credentials and connection strings change even if the server does not.
Re-platforming from one host to another triggers a migration when the entire WordPress installation moves to a new provider. The database crosses network boundaries, and differences in MySQL/MariaDB versions, PHP configurations, and server resource limits surface during this move more than any other.
A domain change (rebranding, TLD swap, adding or removing www) forces a migration even when the database stays on the same server. WordPress stores the domain in hundreds of places across wp_options, post content, and serialized metadata. Changing the domain without rewriting those stored URLs leaves the site with broken links, missing images, and redirect loops. The mechanics of serialized-data rewriting are covered in the manual SQL dump and search-and-replace methods.
WordPress database migration method selection matches the transfer approach to four characteristics of the migration itself. No single method fits every scenario, and the criteria below identify which methods qualify for a given set of constraints.
A WordPress database migration runs through five peer methods, each presenting the same export-transfer-import operation at a different level of access and transparency.
The five methods are ordered from the most accessible interface to the most transparent one, and each is covered in full individually.
A WordPress database migration through phpMyAdmin export and import uses a browser interface that most shared hosting control panels expose by default. The procedure has three phases: export the source database, transfer the resulting SQL file, and import it into the target database.
Export. Open phpMyAdmin on the source host and select the WordPress database from the left sidebar. Choose the Export tab. Select “Custom” to access format options. Set the format to SQL, enable “Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement” (which produces DROP TABLE IF EXISTS directives that clear target tables before loading fresh data), and confirm the character set reads utf8mb4. Click Go. phpMyAdmin generates a .sql file and downloads it to the local machine.

Transfer. The exported .sql file needs to reach the target server. For small files, uploading through the target host’s phpMyAdmin Import tab suffices. For files that exceed the upload ceiling, transferring via SFTP or SCP to the server’s filesystem and importing through the command line avoids the browser limit entirely.
Import. Open phpMyAdmin on the target host, select the destination database, and choose the Import tab. Click “Choose File” and select the .sql dump. The max_upload_size directive, set in the host’s PHP configuration, governs the maximum file size phpMyAdmin accepts via the browser. Shared hosts typically configure this between 2 MB and 50 MB. If the dump exceeds that ceiling, the import fails silently or throws a timeout error. Click Go to begin the import.

One caveat applies. phpMyAdmin alone cannot rewrite serialized data. If the migration involves a domain change, protocol switch, or path alteration, the imported database still contains old URLs embedded in serialized PHP arrays.
Attempting a plain text find-and-replace inside phpMyAdmin’s SQL query box breaks serialization prefixes. A serialized-aware search-and-replace pass, using wp search-and-replace or Interconnect’s Search-Replace-DB, must follow the import to correct those prefixes safely.
A WordPress database migration through WP-CLI wp db export and import runs entirely from the command line over SSH. The procedure requires SSH access to both the source and target servers, with WP-CLI installed and the WordPress root directory accessible.
Three phases (export, transfer, import) execute in sequence:
# Phase 1: Export on source server
cd /var/www/html
wp db export db-backup-$(date +%Y%m%d-%H%M%S).sql
# Phase 2: Transfer to target server
# For a single file (one-shot transfer):
scp db-backup-20260416-143022.sql user@target-host:/var/www/html/
# For large databases or repeated syncs (resumable, delta-only):
rsync -avz db-backup-20260416-143022.sql user@target-host:/var/www/html/
# Phase 3: Import on target server
ssh user@target-host
cd /var/www/html
wp db import db-backup-20260416-143022.sqlwp db export generates a full SQL dump from the WordPress database defined in wp-config.php. The timestamped filename prevents accidental overwrites when multiple exports accumulate on the same server. Running the command from the WordPress root directory ensures WP-CLI reads the correct database credentials.
scp copies the dump in a single transfer, sufficient for most databases. rsync adds resumability and delta compression, which matters when a multi-gigabyte dump transfers over a slower connection or when repeated syncs need to send only what changed.
wp db import reads the SQL dump into the target database, dropping and recreating tables as directed in the file. After import, the database contains every row from the source, but all stored URLs still reference the source domain.
When the migration involves a URL change, wp search-replace rewrites stored values across every table. The manual SQL dump and search-replace method covers the full mechanics of serialized-aware rewriting, including the critical –dry-run preview and the –all-tables flag, because that procedure is the foundational reference for URL rewriting across all methods.
A WordPress database migration using the WP Migrate plugin’s push and pull operates within the WordPress admin dashboard on both the source and target installations. The plugin (sometimes referenced by its historical name WP Migrate DB, its hyphenated form wp-migrate, or its Pro-tier identifiers WP DB Migrate Pro, Migrate DB Pro, and DB Migrate Pro) handles bidirectional database transfers without requiring SSH access or direct database credentials.
Install and activate the WP Migrate plugin on both the source and target WordPress installations. On the receiving side, generate a connection string from the plugin’s settings panel. On the sending side, paste that connection string into the corresponding field.
Two directions define the transfer.
Select the direction that matches the server where administrative access is most convenient. Either direction produces the same result: the target database receives the source data.

The Find & Replace panel appears below the connection settings. WordPress database migration through this plugin handles serialized data natively: the panel accepts old-URL and new-URL pairs and rewrites serialized PHP arrays with corrected length prefixes during transfer.
Adding the source domain in the find field and the target domain in the replace field ensures every stored URL arrives rewritten at the destination. Multiple find-and-replace rows handle protocol changes, path changes, and directory differences in a single pass.
WPMigrate also offers a full-site migration option that bundles media, themes, and plugins alongside the database, a broader operation than database-layer relocation alone.
The WP DB Migrate operation completes when the plugin reports a success state on the initiating side. Verification follows in the post-migration checklist regardless of which method was used to perform the transfer.
A WordPress database migration from a hosting control panel reduces the export-transfer-import sequence to a single managed step. Supply the source site’s URL, admin credentials, and, on some hosts, database connection details. The hosting panel’s migration tool pulls the source database, transfers it to the target environment, and reports success or failure.
cPanel Site Migration, Plesk WordPress Toolkit, MyKinsta, WP Engine portal, SiteGround Migrator, and DreamHost Automated Migration each provide a variant of this workflow. None merits elevation over the others; all abstract the same underlying operation behind a vendor-specific interface.

The trade-off is direct. Managed simplicity removes the need to handle SQL files, SSH connections, or plugin configuration. Reduced visibility means the migration’s internal steps (character-set handling, table-prefix mapping, serialized-data rewriting) happen behind the interface without confirmation.
Whether a given host’s tool rewrites serialized data during domain changes depends on the provider. If the source and target domains differ, confirm that serialized URLs arrived rewritten; if they did not, pair the panel import with a manual search-replace pass.
A WordPress database migration through a manual SQL dump and search-replace exposes every step of the transfer (the raw export, the serialized-aware URL rewriting, and the final import) with nothing abstracted away. The serialized-data mechanics explained here underpin every other transfer method: phpMyAdmin and WP-CLI both lack built-in serialized-aware rewriting, so any migration involving a URL change ultimately depends on the same principles.
Phase 1: Export with mysqldump.
mysqldump --default-character-set=utf8mb4 -u db_user -p wordpress_db > wordpress-db-$(date +%Y%m%d-%H%M%S).sqlmysqldump produces a complete SQL dump of the WordPress database. The –default-character-set=utf8mb4 flag ensures multi-byte characters export correctly rather than falling back to latin1 encoding. The timestamped filename distinguishes this dump from earlier exports. If SSH access is unavailable, the phpMyAdmin export tab produces an equivalent SQL file, the subsequent steps apply identically regardless of how the dump was generated.
Transfer the dump to the target server via scp, rsync, or SFTP.
The serialized-data warning. WordPress stores plugin settings, widget configurations, theme options, and portions of post metadata as serialized PHP arrays in tables like wp_options, wp_postmeta, and wp_usermeta. A serialized string encodes its length as a prefix: s:24:”http://old-domain.com/wp” declares that the string is exactly 24 characters long. Changing old-domain.com to new-domain.org alters the character count, but the prefix still reads s:24:. PHP’s unserialize() function reads the prefix, counts 24 characters, finds a mismatch, and fails. The value becomes empty. Settings disappear. Widget areas go blank. Plugin configurations reset.
Naive find-and-replace, whether through a text editor, sed, or a SQL REPLACE() query, cannot recalculate those prefixes. Every serialized string that contained the old URL breaks silently.
Phase 2: Serialized-aware search-replace.
Two tools recompute length prefixes during replacement: WP-CLI’s wp search-replace command and interconnect/it’s Search-Replace-DB (a standalone PHP script). Both parse serialized strings, perform the substitution, and rewrite the length prefix to match the new value.
# Preview changes without modifying the database (non-negotiable first step)
wp search-replace 'http://old-domain.com' 'https://new-domain.org' --all-tables --dry-run
# Execute the replacement after confirming the dry-run output
wp search-replace 'http://old-domain.com' 'https://new-domain.org' --all-tablesThe –dry-run flag previews every table and reports how many replacements would occur without writing a single change. Running the replacement without a dry-run preview first risks rewriting values that should not change, especially in multisite environments or databases shared with non-WordPress applications. The –all-tables flag ensures that custom tables created by plugins and themes receive the same treatment as core WordPress tables.
Phase 3: Import.
# Import via mysql client
mysql --default-character-set=utf8mb4 -u db_user -p wordpress_db < wordpress-db-20260416-143022.sql
# Or import via WP-CLI
wp db import wordpress-db-20260416-143022.sqlEither method loads the dump into the target database. Run the search-and-replace after the import completes; the replacement applies to the live target database, not to the SQL file.
phpMyAdmin and WP-CLI both lack built-in serialized-aware rewriting, which is why any URL-change migration through those methods requires a separate search-replace pass. The WP Migrate plugin handles serialized rewriting natively through its Find & Replace panel, making a separate pass unnecessary when that plugin performs the transfer.
WordPress database verification after migration confirms that the transferred data arrived intact and the target installation functions correctly. Skipping verification leaves corrupted serialization, missing rows, and broken permalinks undetected until a visitor or client encounters them.
Five checks, performed in sequence, cover the critical failure points:
If any of these checks fail, running a quick WordPress database repair can help resolve structural issues such as corrupted tables or index inconsistencies before they escalate.
An SSL certificate check and a brief confirmation that active plugins load their admin pages without fatal errors add further confidence beyond these five items.
A WordPress Multisite database migration is the process of transferring the database of a WordPress Multisite network, including its shared registry tables and per-subsite-prefixed tables, from one environment to another. Two database-layer facts distinguish it from a single-site migration.
First, wp_blogs and wp_site jointly define the network registry. wp_blogs stores one row per subsite: its domain, path, and activation status. wp_site stores the network’s identity: the primary domain and path that anchor every subsite. These two tables migrate as a paired unit. Importing one without the other leaves the network unable to resolve its own subsites, and WordPress falls back to a generic database error.
Second, cloning a subsite into a different network slot (assigning it a new blog_id) requires site ID remapping across every prefixed table that belongs to that subsite. WordPress names Multisite tables with the blog_id embedded in the prefix: wp_2_posts, wp_2_options, wp_2_postmeta. When the target network already occupies slot 2, the cloned subsite must land in a vacant slot, and every table prefix and every site_id/blog_id reference within those tables must reflect the new number. Uploads directory layout and the distinction between subdomain and subdirectory configurations affect how the network resolves requests, but both sit outside the database layer.
Once the registry tables and site-ID mappings are correct, the Multisite migration proceeds through the same cutover sequence as single-site migrations.
A WordPress database migration cutover for a live site coordinates the switch from source to target so that visitors experience the closest practical approximation to zero downtime, while keeping the rollback path open throughout.
Four phases structure the transition:
The migration is complete when the target server serves production traffic, DNS has propagated past the lowered TTL window, and verification confirms data integrity on the target. The full relocation arc (define the operation, prepare the environment, recognize the trigger, select a method, execute the transfer, verify the result, and cut over DNS) reaches its endpoint with a live, verified target and an unused rollback plan.