Knowledgebase
How to transfer Magento to a new host
In this article we will show you how to transfer your Magento store to a new host.
Moving a Magento installation from one host to another involves 3 steps:
1. Copying the Magento files and folders to the new server.
The easiest way to do this is with an FTP client such as FileZilla. Simply download all your files and folders from the old host and upload them to your hosting account with the new host.
2. Exporting the Magento database from the old host and importing it into a new database on the new host.
The easiest way to do this is with phpMyAdmin.
To export the database from the old host, follow these steps:
- Go to the phpMyAdmin tool at your old host, select your Magento database from the left menu and click the Export tab.
- Select all database tables by clicking Select All in the Export section of the screen.
- Disable foreign key checks by ticking the Disable foreign key checks in the Options section.
- Make sure the Complete inserts and Extented inserts options in the Data section are ticked.
- Tick Save as file at the bottom of the screen and click Go to download the database dump.
To import the database at the new host, follow these steps:
- Create a new MySQL database and add a user to it.
- Open phpMyAdmin, select the newly-created database from the left menu and click the Import tab.
- Click the button next to "Location of the text file" and locate the database dump you downloaded earlier.
- Click the Go button at the bottom of the screen to import the database.
3. Reconfiguring your Magento to work with the new database settings. To do this, you need to edit the following file in your Magento installation directory:
app/etc/local.xml
The lines you need to change in this file are:
<host><![CDATA[localhost]]></host>
<username><![CDATA[mysql_user]]></username>
<password><![CDATA[mysql_pass]]></password>
<dbname><![CDATA[database_name]]></dbname>
You need to replace the settings marked in bold as follows:
- localhost - the database host - most likely you won't have to change it as localhost works on most hosts; if you experience database connection problems, ask your host for assistance as they may be using a different mysql host in their setup
- mysql_user - the database user you created earlier and added to the database
- mysql_user_pass - the password for the mysql user
- database_name - the name of the database you created earlier
The last thing you should do once you update the local.xml file with the new database settings is to flush the Magento cache.
Provided that you have pointed your domain name to the new hosting server, you will be able to access your Magento store at the new host.
As part of our Magento hosting services, all HostKnox customers are eligible for a free Magento transfer to our servers. This means that we will do all of the above free of charge and save you the trouble of having to do it yourself.