Transferring a Magento hosted website isn’t as much of a difficult process as it is time consuming. It’s not an instant process, but it can be done easily with little risk to the files or the database. All you really need is a bit of patience.
In this transfer Magento tutorial, I’m going to go over how you can move your online store from one site to another. Make sure you read this tutorial in its entirety at least once before attempting to do this yourself.
While moving files isn’t a difficult process, you can surely break the website if you’re not paying attention to what you’re doing.
Step 1: Create a Backup of MySQL Database
In this tutorial, I’m going to demonstrate how to create a backup of your database using phpMyAdmin. It’s a quick and easy way to get all of your data with a few clicks of the mouse.
From cPanel, click the link to open “phpMyAdmin.”
Find and click the database you want to download. If you only have the one website, it will be the only one listed. If you use automated systems to install Magento, it may show a “mage” and then a number. Otherwise, it will be the database you created when you first created your site.
Click the “Export” command from the top tool bar.
Keep the format set to SQL and click the “Go” button on the bottom.
This will bring up your download window depending on your operating system and browser. If you’re not able to choose where the file is saved, it will more than likely be placed in your default downloads folder.
Step 2: Moving the Website Files
Website files are relatively easy to move. While it may be time consuming, it’s not a difficult task. A lot of people like to use FTP applications such as FileZilla. This program allows you to connect to your web host and download all of the files for your site directly to your computer.
Using FTP, download the entire root folder of your Magento website.
Once you’ve downloaded your files, you should save them as an archive ZIP file. Normally, I compress my backups and store them on Dropbox. That way, I have a complete copy of the files on the Cloud. These are accessible from any computer system I sit at with Internet connection.
Using the FTP program, upload your files to the new host.
Step 3: Import the MySQL Backup to the New Host
After your files have been placed on the new site, you’ll need to import your database. Otherwise, none of the data that pertains to the site will be available. This includes admin logins and product data.
First, you will need to create a new database on the new host. This is so you can import the data you downloaded in Step 1.
Click on the MySQL Database Wizard from the new web host’s cPanel. You’ll then follow the steps provided to create a new database.
NOTE: Make sure you write down the information you use to create this new database. You will need it to make adjustments in the configuration file of Magento. Otherwise, your site will not be able to access the data.
With the new database ready, it’s time to fill it up with the backup information from earlier.
From the cPanel of the new host, access phpMyAdmin by clicking the icon.
Find the new database on the left and click it to access the table structure.
Click on the “Import” tool from the top tool bar of the empty database.
Choose the file you want to import and click the “Go” button on the bottom. The file you are importing is the SQL database you downloaded in Step 1.
Step 4: Modify the Magento Config File for the New Location
After the database has been uploaded, you will need to change the configuration file of Magento. This needs to reflect the new:
- Database Name
All four of these elements are found in the “env.php” file of Magento. You can find this by going to “app/etc/” in Magento’s root directory. To edit the file, you can use either your FTP program or cPanel.
Replace the information in the block of code with your new database information.
Click the “Save Changes” button on the top right to commit your changes.
Step 5: Refresh the Cache in Magento
This last step is perhaps the easiest. All you need to do now is refresh the cache in Magento. Access the cache by going to the System section and clicking “Cache Management.”
Select all of the segments and click “Flush Magento Cache” in the top right.
Slow and Easy Wins the Race
Take your time when moving your Magento store. As long as your original host is still up and running and you’re making sales, you can take your time and make the transition painless for yourself as well as your customers. Don’t try to rush through the process as it can amplify the risks of making a costly mistake.
Author: Chris Racicot
Chris is the Support Manager at GreenGeeks and has been with the company since 2010. He has a passion for gaming, scripting and WordPress. When he’s not enjoying his sleep, he’s working on his guitar skills and fiddling with 3d printing.