How to Migrate WordPress Sites Without Plugins

I’ve used WordPress plugins for my share of site migrations. Anything from All in One WordPress Migration to iThemes BackupBuddy.

The problem?

Sometimes the migrations will simply fail. And after you bang your head repeatedly on the desk, you hope for a better way. The good news?

There is a much more reliable method for migrating your WordPress sites!

In fact, after you move your first WordPress site using the command line and sFTP, you’ll never go back to using a WordPress migration plugin again. Ever. If people knew how easy this was, the site migration plugin business would be dead overnight.

You’ll need command line access to your server. You’ll also need to update your DNS records to point to the new server IP. And you’ll need an sFTP client.


Here are the bullet proof steps to move sites:

1. Export Your Database

Open up the wp-config.php file for your current site to get the db name, user and password.

Next use the command below to export your database. It’s going to ask you for the password, and then it will export the database as ‘sitedatabase.sql.’

mysqldump --no-tablespaces --opt -u USER_NAME -p DATABASE_NAME > sitedatabase.sql

*Note: This command will not include table spaces. The PROCESS privilege is new as of MySQL 5.7.31 and MySQL 8.0.21 and is required to export table spaces. So to get around this, we tell the export process to skip them as they’re irrelevant for WordPress sites.

You will be prompted to enter the password, which is also contained in the wp-config.php file.

2. Copy the Exported Database

You can find the exported database file with an sFTP client like ForkLift from Binary Knights (for OSX users). Note: The sql file will be in the root folder on your server. Not the root of your server, the root folder.

3. Zip Up Your Website Files

Next on the command line you need to move to the parent folder that your website files and folders are located in. Basically, the folder that contains your WordPress folders like wp-content, etc.

Example: If your site files are in /var/www/ then enter the following command:

cd /var/www/

Now it’s time to zip up your site! Make sure you remove any archived backup files from those plugins that don’t work that well anyway — The backup files hog a lot of space. Once you’ve cleaned stuff up run:

zip -r choosefilename public_html

*Note: If your site files were in another folder besides ‘public_html’ then name that folder in the command.

4. Copy the Zip File

You’ll see the zip file in the ‘’ directory. Copy this to your local computer.

5. Install WordPress on Destination Server

You need to get a clean install of WordPress up and running on the new server.

6. Remove the WordPress files

Once you have the new WordPress install live, we need to toast all the files.

On the destination server, sign in via command line and type the following command where is the name of your website, and public_html is the folder that contains the WordPress files and folders.

rm -r /var/www/

7. Copy Zip and SQL Files to Destination Server

Now use your sFTP client to copy the zip and sql files to the destination server. Place them in the parent folder for your site. Example: If your new site is located in /var/www/ copy the files to /var/www/

8. Unzip the Files

On the command line of the new server, move the folder you copied the files to above.

cd /var/www/

Now unzip the zip file (use the name you selected in Step 3):


9. Import the Database

Open up the WP-Config.php file for your your new WordPress site on the destination server.

Once you have this open and see the database name, user name and password, type the following command on the command line (use the name of your sql file from Step 1):

mysql -u USER_NAME -p DATABASE_NAME < sitedatabase.sql

Once you enter the command, it will prompt for the password.

*Note: If you receive an ‘Unknown Collation’ error, edit the sql file in a text editor like Sublime Text. Find and replace “utf8mb4_0900_ai_ci” with “utf8mb4_general_ci“. Then copy the updated SQL file back to your new site folder and run the import command again. See this Freaky Jolly article for more information.

10. Enable Fail2Ban on Gridpane

If you’re using Gridpane and had Fail2Ban enabled on the original site, you’ll need to enable it on the new site or you’ll get errors in your browser (that say nothing about the Fail2Ban plugin).

11. Wrapping Up

That’s it! This may have seemed like a lot of steps, but once you see how easy it is to migrate your WordPress sites without using problematic and expensive migration plugins, you’ll never go back.

A special thanks to Gridpane for providing some of the steps here. If you aren’t using them, I highly recommend it!