It is likely that if you are interested in WordPress or you are already working with it, you are going to run into a situation where you have to move your WordPress website to a different hosting plan.
How it’s done?
WordPress website has 2 main components, website files and the database that holds the website information. When you move your WordPress website both of these have to be accounted for.
Moving files is easy. All you have to do is to download them, and then re-upload them to a server you’re moving to. You can do this from a browser, via FTP client, or a terminal, it’s a relatively painless process. When uploading files it is important to upload them in the root folder of your new website.
The database is usually accessed from your hosting plan using phpMyAdmin. To create a backup of it, select your database and run the export or dump command. This will create a .sql file you can then import in the destination website’s database.
After you imported the database, and transferred the files over, it is important to make sure they can work together on the new hosting by editing the wp-config.php file. This file contains the database credentials, and if they’re not correct your website will return an Error establishing a database connection screen. Most commonly DB Name, User and Password will differ, and in some rarer cases you might need to update hostname too.
When all is done, the last step is to update your DNS records and allow the change to propagate.