move Magento 2 website to a new service

The client can request to change hosting service at any time when they feel no longer satisfied with the current service. So in this article, we will learn how to move Magento 2 website to a new service.

1. Export Database

You can login to login to phpMyAdmin do it.

Magento 2 export database

Or connect to your Magento directory with SSH then run the below command to do it.

mysql -p -u username database_name > magento_backup.sql

2. Make zip file from Magento folder

Connect to your Magento directory with SSH then run the below command

zip -r magento_back.zip *

3. move website to new service

upload file zip and database to new service.

Connect to new host with SSH then run the below command to unzip file.

unzip magento_back.zip

Import database

Then you login to phpMyAdmin to import database.

Magento 2 import database

Or run the below command

mysql -p -u username database_name < magento_backup.sql

Update new info

Find app/etc/env.php file then make changes related to the information of the new database that you just created on your domain (dbname, username, password, downloadable_domains)

If you have change domain you need go to phpMyAdmin on core_config_data table change value web/unsecure/base_url.

Magento 2 change base url

Or run the below command

php bin/magento config:set web/unsecure/base_url 'http://yourdomain'

If you don’t change the domain you need to go to manage domain update IP address and then wait for it to work.

That’s all it takes to migrate your site to a new server. Hope can help you move Magento 2 website to a new service. Contact us if you face any problems during the installation process.