How to migrate a WordPress site to a new host (step by step)

This is a tutorial on how to migrate a WordPress site to a new web host. I am going to try and keep this as simple and short as possible. Just follow the steps below and you should be up and running again in no time.

How to migrate a WordPress site to a new host

When it comes to migrating your WordPress site, you have a few different options. The very first step is to get a backup and or export of your current site. Or if you go with a WordPress host like Kinsta, they will migrate your site for free.

Exporting your database

We will first need to backup your MySQL database. This is where all the content for WordPress is stored. Your post and page data, comments, plugin data, etc.

Option 1 – cPanel

Step 1

Cpanel Backups

If you are running cPanel you easily backup your database by clicking into the “Backups” area in the dashboard.

Step 2

Then simply click on the name of your database and it will prompt you to save it to your computer. Pretty easy!

Cpanel Download mySQL Database

Option 2 – Exporting database manually with phpMyAdmin

Step 1

If you don’t have cPanel available then you can always export your database manually using phpMyAdmin. If you don’t know the URL for your phpMyAdmin page, you can always ask your web host to provide this to you. Or even ask for them to do this for you.

Once you login to phpMyAdmin, click on the name of your database on the left-hand side.

phpMyAdmin

Step 2

Then click on the “Export” tab at the top.

phpMyAdmin Export db

Step 3

Select “Custom” and make sure all the tables are highlighted. They should be by default.

phpMyAdmin Export Method

Step 4

Scroll down and select “Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement.”

phpMyAdmin Object Creation Options

Step 5

Scroll down and click on “Go.” It will then prompt you to save the .mysql file to your computer.

Go Button

Option 3 – Export database with WordPress backup plugin

Your third option is to backup your database using a WordPress backup plugin. Here are a few popular ones:

We will cover this more in-depth in another post.

Exporting your WordPress files

Now that we have your database saved, we need to save your WordPress files. You can use the cPanel backup method, but I recommend using FTP since we will be needing to edit a configuration file later. I suggest using ForkLift or FileZilla. You will need to connect to your web host. If you don’t know how, reach out to your hosting provider and they should be able to help you.

You will want to grab everything from the root of your WordPress install. You should see folders like “wp-admin” and “wp-includes.” Note: If you already a fresh WordPress installation at your new host then all you need is the “wp-content” folder.

You will want to grab everything from the root of your WordPress install. You should see folders like “wp-admin” and “wp-includes.” Note: If you already a fresh WordPress installation at your new host then all you need is the “wp-content” folder.

download wp-content folder
Download wp-content folder via SFTP

Create a database at your new host and import tables

Now on your new host, we are going to create a new MySQL database and import your tables. This tutorial assumes you are running cPanel.

Step 1

In your cPanel dashboard, click into “MySQL Databases.”

Cpanel MySQL Databases

Step 2

Name your database and click on “Create Database.” It doesn’t have to match the name it was from your previous host.

Cpanel Create New Database

Step 3

Now under MySQL Users, we need to create a new user. Make sure you keep track of what you use for the password, as you will need this in a few minutes.

MySQL Users

Step 4

Then we need to add the user to the database. Click on “Add.”

Add User to Database - Cpanel

Step 5

Then click “All Privileges” and click on Make Changes.

mySQL All Privileges

Step 6

Now login to phpMyAdmin and click on your new database that you created.

phpMyAdmin

Step 7

Now click on “Import.”

phpMyAdmin Import

Step 8

Click on “Browse,” select your .mysql file we saved earlier, and click on “Go.”

Go Button

If everything works OK you should see a green box with a message like the one below.

MySQL Successful Import

Change wp-config.php file and upload files via SFTP

Now we need to edit your wp-config.php file to work with your new database.

Step 1

In the files you downloaded earlier, look in the root folder, right click on wp-config.php and select edit.

Edit WP-Config.php

Step 2

Now you will need to update the information with what you used above. So the database name you chose, the database user, and the password. Information below is only an example. Once you update those three pieces of information, save the file.

Update WP-Config.php

Step 3

Now upload your files to your new web host via FTP. Upload everything if you didn’t have WordPress installed at the new host. If you did, simply upload and overwrite the “wp-content” folder.

Summary

That is all! You should now be up and running on your new host. I also recommend reading our tutorial on “How to Preview Your Website Before Switching DNS.” If this tutorial on how to migrate a WordPress site was helpful, please let us know below in the comments.

author bio
Brian Jackson

I craft actionable content and develop performance-driven WordPress plugins. Connect on X, subscribe to my newsletter (once a month), or buy me coffee.

4 thoughts on “How to migrate a WordPress site to a new host (step by step)”

  1. As usual with your posts Brian, that’s the most detailed guide on the subject right here! Brilliant!
    There are a few plugins for migrating the database but this is much better, thanks.

    Reply
  2. Hey Brian, Great blog! If you have access to WHM you can do it in minutes. Godaddy was going to charge me something ridiculous like $150 per site (a bit of a scam if you ask me) until I figured out you can connect to another hosting account and import EVERYTHING (files/DB/Emails) in WHM.

    Reply

Leave a Comment