How to Migrate a WordPress MySQL Database and Transfer a WordPress Website to a New Host
First Step in the WordPress Website Migration is Back up Database of the existing WordPress Website (MySQL Database). To keep this simple, We will refer to this Website as “Website 1”. Create a destination folder for the Database Backups on your Server that you will Designate as your Backup Folder (ie. DB_Backps). Now go to the Hosting Control panel (on Website 1), and find where you can edit the MySQL Database and create a backup of the WordPress Website you are wishing to Migrate. Make sure to record all Database Backup Host Locations, Host user names and as well as passwords. Now FTP into your Server and confirm the Database Backup file. Once the Database File is created and confirmed, you can now begin to remove all Website files from “Website 1” as well as the Domain Name Folder on the Server. Make sure to access your Control Panel and take down the current website Folders.
Now you can Point the New Domain Name (A Record) and Name Servers of “Website 1” to the New Server Location (we will refer to as “Website 2”). Once Name Servers have populated then you can create a destination folder for the WordPress Install (normally named after the domain name). Install the most updated version of WordPress to this Folder. Make sure to create the Installation Location that you will remember, I recommend installing off the root/ directly off the Root Domain and NOT behind a sub-domain Folder. This will allow the WordPress Engine to be the Primary Engine for your Home Page as well as Website.
Once a Fresh (Most Recent) version of WordPress is installed on the New Server, you can then start to import/restore the Database. Create a “/d_b_backups” Folder off the Site /Root. Upload the “Website 1” Database (that you backed-up earlier). Make sure to Create a New Database in MySQL, then Restore the “Website 1” Database over the New Database (make sure to record all Database connection information here).
Final Steps, you will need to FTP into the New Site “Website 2” WordPress Installation and pull down the “wp-config” and “wp-config-sample” files. Here you will be editing the Database connection. This is where you will Edit the Host Location, Host Name, User Name and Password for the Restored MySQL Database connection. These 2 files (WP-Config and WP-Config_Sample) speak to the Database so this is where you need to Edit in the New MySQL Database connection information.
Once the Database has Restored, Type the Domain Name into a Browser and your Website will be completely migrated over to your New Host/ New Server.
If you are running into any errors, like a “Database Can Not Establish Connection Error”, double check your wp-config and wp-config-sample files and make sure you have entered the Correct Credentials and Host Location. If you need further assistance, I found this Video online, this is a Helpful Tutorial as well.