How to Migrate a WordPress Site. Tutorial Overview.This tutorial will explain how to migrate a WordPress website from one host to another, how to download and upload a WordPress site via FTP, how to create a MySQL database, how to add a user to the database, how to import and export a MySQL database, how to connect the website to the database and the steps to follow if you are moving to a new domain name.Quickies.A Brief Overview of Migrating a WordPress Website.How to Download a WordPress Website via FTP.Export a MySQL Database.Create a MySQL Database in cPanel.Add a User to a Database in cPanel.Import a MySQL Database in cPanel.Upload WordPress Website Files via FTP.Connect a WordPress Website to a MySQL Database.Migrate a WordPress Site to a Different URL.How to Edit all WordPress URLs with Search and Replace.How to Migrate a WordPress Website to a New Host.Here are a few definitions to make this process easier:WebsiteA – The website that is being moved.DatabaseA – The database that is being moved.ServerA – The server that the website is being moved from.WebsiteB – The website being replaced (if applicable).DatabaseB – The new database.ServerB – The new server or hosting service that the site is being moved to.A server is a device that your hosting service uses to store your website files. In this tutorial, when I use the word “server” I am referring to your hosting plan.A Brief Overview of How to Migrate a WordPress Website.Download WordPress files from ServerA to your desktop.Export the MySQL database from ServerA to your desktop.Create a new MySQL database in cPanel on ServerB.Import DatabaseA into DatabaseB.Upload the WebsiteA files to ServerB.Connect WebsiteA to the database.How to Download a WordPress Website via FTP.Create an empty folder on your computer desktop to store WebsiteA in.Make an FTP connection to ServerA. If you are unsure how to do this, check out this tutorial: How to Create an FTP Account in cPanel.Navigate to the directory that WebsiteA is in.Select all of the folders that make up WebsiteA.This is what a standard set of WordPress files and folders look like. Download all of these files into the folder you created on your desktop.We’ll come back to this later.Next: Export a copy of DatabaseA.How to Export a MySQL Database.Login to cPanel or the hosting account of WebsiteA and go to the cPanel.Once you are in cPanel, click on phpMyAdmin.In the left side panel, click on the database that WebsiteA is connected to.If there is more than one database and you are not sure which one is the right one:Open the folder that contains the files from WebsiteA that you just downloaded.Open the wp-config.php file in a text editor.Look for the line of code that looks like this: define( ‘DB_NAME’, ‘database3’ );database3 is the name of the database.Click on the correct database in the left side panel of cPanel.Click on Export.Set Export Method: to Quick and Format: to SQL.Click on Go.This will download DatabaseA. We’ll come back to this later.Next: Create DatabaseB on ServerB. (the new server)How to Create a MySQL Database in cPanel.Login to cPanel or the hosting account of WebsiteB.Once you are in cPanel, click on MySQL® Databases.Enter a name for DatabaseB in the New Database field.Click Create Database.This name must be unique. If you are on a shared hosting plan and someone is already using the database name you want, you will get a warning to choose a different name.Once DatabaseB is created click Go Back.Now we need to create a user to pair with DatabaseB.Enter a Username and generate a Password and keep this information in a place you will remember.Click on Create User.Click on Go Back.Next: Add this user to DatabaseB.How to Add a User to a Database in cPanel.Scroll to the section labeled Add User To Database.In the User field select the user you just created.In the Database field select DatabaseB. (the database you just created)Click on Add.On the next screen we will set the user privileges for DatabaseB.At the top of the page select All Privileges.Click on Make Changes.Click Go Back.Next: Import DatabaseA into DatabaseB.How to Import a MySQL Database in cPanel.Login to cPanel if you are not already.Once you are in cPanel, click on phpMyAdmin.In the left side panel, click on DatabaseB. (the new database)Click on Import.Click on Choose File and upload DatabaseA.Click on Go.If everything goes well, you will get a success message.If you are replacing an existing website (WebsiteB), you will need to remove it from the server before uploading WebsiteA. If you need to retain a copy of WebsiteB, you can follow the directions here. Then you can delete WebsiteB from ServerB.Next: Upload WebsiteA to ServerB.How to Upload WordPress Website Files via FTP.Make an FTP connection to ServerB. If you are unsure how to do this, check out this tutorial: How to Create an FTP Account in cPanel.Navigate to the directory that WebsiteA is going in.Upload all of the files from WebsiteA into this directory.Next: Connect WebsiteA to the database.How to Connect a WordPress Website to a MySQL Database.If you are not already connected, make an FTP connection to ServerB. If you are unsure how to do this, check out this tutorial: How to Create an FTP Account in cPanel.Navigate to the directory that WebsiteA is in.Locate the wp-config.php file in the root directory of the website.Open this file in a text editor.The next couple steps will use the username and password we created in this section.Replace database_name_here next to DB_NAME to the name of the database.Replace username_here next to DB_USER to your username.Replace password_here next to DB_PASSWORD to your password.Save the file.Enter the URL in a browser and view the website.How to Migrate a WordPress Website to a Different URL?If you are moving a WordPress site to a different URL there are a few additional things you need to do to make things work correctly.Database Edits.After you import the database to the new server:If you are not already there, login to cPanel and go to phpMyAdmin.Click on the database name in the left side panel.Click on wp_options.Locate the siteurl in the option_name column.Click on Edit on the left of the siteurl row.In the option_value field, change the URL to the new URL.Click on Go in the lower right.Repeat these steps for the home row.To recap, you shoud have changed two rows in the wp_options table, the siteurl row and the home row, to the new URL. These rows are usually number 1 and 2.Login to the admin area of the website.In the admin sidebar, under Settings, click on Permalinks.Scroll to the bottom of the page and click on Save Changes.This will reset all of the permalinks on the website.Next: Use search and replace to change all of the old URLs.How to Edit all WordPress URLs with Search and Replace.There are still going to be old URLs in the database so we need to change them to the new URL. I have always used the Better Search Replace plugin for this. There are many plugins out there that will work just fine, this just happens to be the one I use.Download and activate the Better Search Replace plugin. If you are unsure how to do this, check out this tutorial: How to Install a WordPress Plugin.In the admin sidebar, under Tools, click on Better Search Replace.Enter the old URL in the Search For field.Enter the new URL in the Replace With field.Warning: This action modifies the database and is irreversible. Take a backup of the database before running this action.In the Select Tables box, select all of the tables.You will notice that the Run as a dry run? box is selected by default. As long as this is selected it will not make any chages to the database. When you are ready, un-select the Run as a dry run? box and click Run Search/Replace.There might be URLs hard coded into your WordPress files. If this is the case you will need to find them and change these as well.If you need assistance to migrate a WordPress website, please contact us at 2640media.com. We will be glad to help!Check out my other tutorials and reviews @ TwentySixForty. Additional Posts. Web DevelopmentCSS Media Queries for all Devices.Read More WordPressHow to Make a WordPress Custom Post Type.Read More WordPressHow to Make My WordPress Site Faster.Read More Leave a ReplyCancelYour email address will not be published. Required fields are marked * Save my name, email, and website in this browser for the next time I comment.