Database migrations should be predictable and reversible.
Prerequisites
- SSH access (source + destination)
- DB credentials for export/import
- Enough disk space for the dump file
- A rollback plan (snapshot or backup)
High-risk warning
If the source site is “live-ish” (traffic, writes), use a consistent export strategy.
Export
InnoDB consistency (live-ish sites):
mysqldump --single-transaction -u <db_user> -p <database_name> > backup.sql
Transfer
Use scp (or your cloud provider’s secure transfer):
scp backup.sql <dest_user>@<dbhost1>:/tmp/backup.sql
Import
mysql -u <db_user> -p <database_name> < /tmp/backup.sql
Verify
- Confirm
wp-config.phpDB settings - Flush permalinks
- Test login + front-end
Notes
- Avoid manual SQL edits unless you’re confident in the implications
- Keep the original dump until the site is verified end-to-end
Related
- Full WordPress site migration (files + DB + config) on Ubuntu — when you’re moving the whole site
- Changing WordPress site URL or hosting folder safely — full URL/folder changes
- WordPress backup and restore using WP-CLI on Ubuntu — backup and restore flow
- Safer plugin updates on production WordPress — update discipline before/after moves