For WordPress installations, there are just two primary components that you need access to in order to manually migrate the installation to a new host: the files and the database.
One of the easiest methods to migrating your files from your old host to a new one would be to download the files using FTP to your local computer, and then upload them to the new host.
First: Obtain or create FTP or SFTP login details for your old host.
Second: Connect using an FTP client such as Filezilla.
You may want to enable showing hidden files, to ensure you download everything.
In Filezilla, you can select Server -> Force showing hidden files to enable that.
You can find our Filezilla setup guide here.
Third: Download your website’s files from the old host to a folder on your local computer.
Ideally, you should create a new folder on your computer to hold the files while you are doing the migration.
Fourth: Open a new window/connection in your FTP client to your new host.
If you need to create an FTP account, you can create an FTP account in your cPanel or relevant control panel; or by creating one directly on the server if you are hosting on your own server (i.e. VPS or dedicated server).
Just ensure that your FTP account has access to the public_html directory or root directory for your domain on the server.
Fifth: Upload your content to the new host.
You will want to upload it to the root directory for your domain.
If the domain is the primary domain of the new host, that will be your public_html directory.
As WordPress stores the vast majority of your data (posts, user data, etc.) in the database, copying over the database is the most crucial step to ensuring all your data is migrated properly.
First: Export the database from your old host.
If your old host has phpMyAdmin available as a database management interface, you can export databases via phpMyAdmin.
It will prompt you to save the export as a .sql file to your local computer, which you should save to your local computer, ideally to the same or a similar folder to the one you made for migrating the site’s files.
Otherwise, if you just have SSH access to the server, you can export the database using mysqldump. Save the export as a .sql file, and then copy the file to your local computer using FTP or SFTP.
Second: Create a new database and database user on the new host.
You can create a database and database user through your cPanel or relevant control panel. Otherwise, on your own server (i.e. VPS or dedicated server), you can manage MySQL databases and users via the terminal.
Ensure that your database user has full permissions to the database.
If possible, you can attempt to name the database and user the same as they were on the old host.
Take note of the database name, user name, and user password, as you may need them later to update the WordPress configuration.
Third: Import the database to the new host.
If your new host provides phpMyAdmin as a database management interface, you can import databases via phpMyAdmin.
Otherwise, if you just control the server via SSH, you can upload the .sql file to your server using FTP or SFTP, and import the database using mysqldump.
Fixing the Database Connection
It is not always, but is sometimes, necessary to update your WordPress configuration file with updated details to be able to connect to the database.
If you receive a ‘Error connecting to database’ error on your WordPress installation, or it instead prompts you with a WordPress setup page, you should double check this part of the migration to make sure your WordPress installation is connecting to the correct database.
The WordPress configuration file is called wp-config.php and will be located in the root of the folder you uploaded your site’s files to.
Edit the file using your control panel’s file manager, or using a terminal based editor, then within the file (most commonly near the top of the file) are four ‘define()’ statements that declare the important database connection details:
define( 'DB_NAME', 'database_name' ); define( 'DB_USER', 'database_username' ); define( 'DB_PASSWORD', 'user_password' ); define( 'DB_HOST', 'database_host' );
This is where you will enter the database name, user name, and user password that you set in Step 2 of migrating the database.
You will enter those values within the second set of quotes of each line.
define( 'DB_NAME', 'mydatabasename' );
DB_HOST definition is then specifying the server address where the database is hosted.
Since this is on the same server, you can just set it to be
'localhost' if it isn’t set to that already.
While this guide is for information on how to be able to migrate a WordPress installation yourself, there are also third party tools and plugins available for use to clone an installation to or from another host, making the processes a bit simpler.
Hostwinds also offers migration assistance to hosts with us at no additional charge. If you would like our technicians’ assistance with migrating your site, all that would be required is a technical support ticket with either access details to your old host, or let us know where we can find a backup of your data.