Hosting · Guide
How to Migrate WordPress Manually (Files + Database)
Short answer
To migrate WordPress manually, copy all files from the old server to the new one, export the database and import it into a new empty database, then update wp-config.php with the new database name, user, password and host. If the domain changes, update the site URL in the database and fix old URLs in post content. Test the copy fully before you point DNS at the new server.
Key takeaways
- A manual migration moves files and the database together. Copying only one half leaves a broken site.
- WordPress.org recommends PHP 8.3 or newer and MySQL 8.4 or MariaDB 10.11 or newer for a new host.
- Edit only DB_NAME, DB_USER, DB_PASSWORD and DB_HOST in wp-config.php when the database details change.
- A plain search and replace can break saved settings, so limit it to wp_posts or use a WordPress-aware script.
- Test the copy fully before DNS changes, and keep the old site live until the new one passes every check.
What does a manual WordPress migration move?
A manual migration moves four parts: the WordPress files, the wp-content folder, the wp-config.php settings, and the database that holds every post, page, user and setting.
The files include WordPress core, your themes, plugins and uploads. The database holds the content and settings, so both halves must move together or the copy will not work.
| Part | Where it lives | How it moves |
|---|---|---|
| WordPress core | wp-admin, wp-includes and root PHP files | Copy the files, or install the same WordPress version on the new host |
| Themes, plugins and uploads | wp-content | Copy the whole folder |
| Settings | wp-config.php and .htaccess | Copy, then edit for the new server |
| Content and users | MySQL or MariaDB database | Export to a .sql file and import it |
WordPress.org's Moving WordPress guide explains the same split: files and database move together, and the site address settings change only when the URL changes.
Email, DNS records and SSL certificates do not move with WordPress. Mail lives in your DNS and hosting panel, so check those separately before you cancel the old host.
What do you need before you start?
You need SFTP or SSH access to both servers, database access on both ends, and a full backup stored away from both servers.
Check the new host first. WordPress.org's Requirements page recommends PHP 8.3 or newer and MySQL 8.4 or MariaDB 10.11 or newer as of November 2026. WordPress still runs on PHP 7.4 and MySQL 5.5.5 or newer in older setups, though those versions are past end of life.
If the new host runs an old PHP version, read how to update the PHP version in WordPress before you move anything.
Take a full backup of the files and the database first, and keep a copy on your own computer. A backup is also your way back if any step below goes wrong.
If you do not have a backup routine yet, start with how to back up WordPress.
How do you copy the WordPress files?
Download the whole WordPress directory from the old server, then upload it to the new server's web root.
- Connect to the old server with SFTP and download the full WordPress folder, including hidden files such as .htaccess.
- Upload the same folder to the new server, or compress it first and extract it there to save time.
- Check that wp-content, wp-config.php and .htaccess all arrived.
tar -czf site-files.tar.gz -C /path/to/public_html .
tar -xzf site-files.tar.gz -C /var/www/example.com
With SSH on both servers, one archive moves faster than thousands of small files. Without SSH, SFTP works too, but it takes longer on large media libraries.
Compare the file count and total size on both servers after the upload. A mismatch means the transfer stopped early, which is easy to miss on a slow connection.
How do you export and import the database?
Export the old database to a .sql file, create an empty database on the new host, then import the file into it.
- Open phpMyAdmin on the old host, select the database named in wp-config.php, and use Export with the Custom method.
- Select all tables, tick the option to add DROP TABLE statements, and save the file.
- On the new host, create an empty database and a user with full rights to it.
- Open phpMyAdmin on the new host, select the empty database, and use Import to load the .sql file.
mysqldump -u olduser -p --single-transaction olddb > site.sql
mysql -u newuser -p newdb < site.sql
The Codex guide to moving WordPress notes that if the database name or user changes, wp-config.php must be edited to match. On a new host, those values almost always change.
Check the import for errors before you move on. A half-imported database looks fine until a page or a login fails.
Large databases may exceed the phpMyAdmin upload limit on the new host. If the import fails, ask the host to raise the limit or import from the command line instead.
MySQL's mysqldump documentation calls the tool a logical backup: it writes SQL statements that rebuild your tables and data when you run them on the new server.
The same docs warn that mysqldump is not built for very large databases, because restoring replays every statement and can take a long time. For a big site, split the export into parts or use the host's backup tool instead.
The docs also note that mysqldump needs SELECT rights on the tables it dumps, plus extra rights for views and triggers. If an export fails with a permission error, ask the host to check the database user's rights before you retry.
How do you update wp-config.php for the new server?
Edit DB_NAME, DB_USER, DB_PASSWORD and DB_HOST in wp-config.php so they match the new database you just created.
You only need to change these four values when the database details change. WordPress.org's Moving WordPress guide says the same: edit wp-config.php only if the database moved, was renamed, or got a new user.
define( 'DB_NAME', 'newdb' );
define( 'DB_USER', 'newuser' );
define( 'DB_PASSWORD', 'newpassword' );
define( 'DB_HOST', 'localhost' );
Keep a copy of the old wp-config.php before you edit it. If the new copy shows a database connection error, the first place to look is these four lines.
What do you do if the domain name changes?
When the domain changes, update the site address in the database and replace the old domain wherever WordPress stored it in post content.
The two rows to change are siteurl and home in the wp_options table. WordPress.org's Moving WordPress guide shows how to edit them in phpMyAdmin, or you can define WP_HOME and WP_SITEURL in wp-config.php as a quick fix.
A plain search and replace on the whole database can break saved settings, because some themes and widgets store values with the length of the URL marked. The Codex guide warns about this and suggests limiting the replace to the wp_posts table or using a script built for WordPress databases.
After the URL change, open Settings, then Permalinks, and click Save to rebuild the rewrite rules. Also check that images and internal links point at the new domain.
If links still point at the old address after the move, see how to fix broken links after a migration.
How do you test the new copy before switching DNS?
Test the copy on the new server with a temporary address or a hosts file entry before you change DNS.
- Log in to wp-admin on the new copy and open the dashboard, a post, a page and the media library.
- Submit a form, place a test order if you run a store, and check that images load.
- Open Settings, then General, and confirm the WordPress Address and Site Address show the right domain.
To test with the real domain before DNS changes, add the new server IP and your domain to your computer's hosts file. Remove that line after the switch so you stop bypassing DNS.
Keep the old site live while you test. Visitors still reach the old server until DNS changes, so nothing is lost if the copy needs another pass.
How long does a manual migration take?
A small site takes 30 to 60 minutes by hand, while a large site with many uploads can take several hours, mostly in file transfer time.
DNS adds its own wait after the move. Bluehost's DNS guide says to allow up to 24 to 48 hours for propagation, though most visitors see the new server much sooner.
Plan the switch for a quiet hour and warn anyone who edits the site. Edits made on the old site after the database export will not appear on the new copy.
Keep a written checklist of each step and tick it off as you go. A missed step, such as forgetting the .htaccess file, is the usual cause of a broken copy after a move.
For the search side of the switch, read how to move a WordPress site without losing SEO.
What mistakes should you avoid?
These five mistakes cause most failed manual migrations.
- Moving without a backup you have checked. Open the archive and confirm the files and the export are complete.
- Forgetting hidden files such as .htaccess, which holds your permalink and redirect rules.
- Running a plain search and replace across the whole database and breaking saved widget and theme settings.
- Leaving a RELOCATE line in wp-config.php after the move. WordPress.org's guide calls this insecure and says to remove it once the address is fixed.
- Cancelling the old hosting before the new copy has passed every check.
Frequently asked questions
Can I migrate WordPress without a plugin?
Yes. Copy the files to the new server, export the database and import it into a new empty database, then update wp-config.php with the new database details. Plugins make the job faster, but the manual route works on any host with SFTP and database access.
Do I need to reinstall WordPress on the new host?
No, if you copy the files. The copied files already include WordPress core, your themes and your plugins. You only install a fresh copy when you want a clean start, or when the old files are damaged and you would rather rebuild.
What happens to my email when I migrate WordPress?
Nothing, if your mail lives outside WordPress. Email runs on DNS records, not on WordPress files, so it keeps working while you move the site. Copy your MX, SPF and DKIM records to the new DNS zone before you change nameservers, or mail may stop.
Why does my migrated site show a database connection error?
The four database values in wp-config.php do not match the new server. Check DB_NAME, DB_USER, DB_PASSWORD and DB_HOST against the database you created on the new host. Also confirm the database user has full rights to that database, and that the import finished without errors.
How do I migrate a WordPress multisite manually?
Multisite needs extra database edits beyond a single site move. WordPress.org's Moving WordPress guide says multisite installs need manual database edits, and the network settings store the domain in more tables. Unless you know those tables well, use a migration plugin or ask the host to move it.
Sources
- Moving WordPress Developer.WordPress.org
- Requirements WordPress.org
- Moving WordPress WordPress Codex
- How to Configure DNS Settings in WHM Bluehost
- mysqldump — A Database Backup Program MySQL
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
