MIGRATION PROCEDURE FOR MAGENTO 2 FILES FROM LOCALHOST TO SERVER
Created by Bhagyashri Vibhandik on Date: 29/10/2018
STEPS OF MIGRATION PROCEDURE
- Export Your database from localhost.
Magento2 Database is very large in size so first you don't export directly using phpmyadmin export option.
Instead You use following command for exporting database..so Follow the following steps..
- Open shell prompt from xampp control panel
- Goto the xampp/mysql/bin directory by cd command.
- Write this command for export database.
mysqldump -h hostname -u username -p password databasename > path (for downloading database)
e.g : mysqldump -h 127.0.0.1 -u root -p markone > C:\xampp\htdocs\bhagyashri\markone.sql
- Make your Magento files in zip format
Just go to htdocs folder (if XAMPP) or www folder (if wamp)then go to your project folder and compress all the files in zip format.
- Create and Import Database
Write this command for importing database
mysql -h hostname -u username -p databasename < path (where your database is downloaded)
e.g : mysql -h 127.0.0.1 -u root -p markone < C:\xampp\htdocs\bhagyashri\markone.sql
- Upload your Magento Files
Upload the zip file of Magento file that you had made in step2 After you have uploaded it, extract that files there.
- Change /app/etc/env.php file for access a magento system to your new Database.
In Magento 2.0, the configuration file that contains database settings and other information is located here:
/app/etc/env.php
In this file we do settings for database connections..
'db' => [
'table_prefix' => '',
'connection' => [
'default' => [
'host' => 'localhost',
'dbname' => 'markone',
'username' => 'root',
'password' => '',
'active' => '1'
]
]
],
Here we set database name, Hostname, Username and password for server.
Also change Backend Url which is by default admin.
'backend' => [
'frontName' => 'admin'
],
This allows you to define what the admin login area’s URL should be.
we recommend changing this, so that you can at least make it more difficult for attackers to not know where to go to try to find your login screen.
Install date: the date that your Magento 2.0 installation was installed.
'install' => [
'date' => 'Sat, 25 Aug 2018 04:57:13 +0000'
]
- Identify your new Domain Name for Magento System
Go to your Magento database and search Table Core_Config_Data and replace your URL to your Domain name in
“web/unsecure/base_url” , “web/secure/base_url”.
- Clear Cache
May run static content deploy php bin/magento setup:static-content:deploy
Remember to clear Magento Cache and delete var/generation, var/composer_home, var/view_preprocessed.
- Run Your Project