How to setup existing Magento 2 Project?

How to setup existing Magento 2 Project ?

In this tutorial you’ll learn how to setup existing magento 2 project in new domain or locally.

Follow below steps to setup existing magento 2 project.

  1. Import Database :

Import the database by using this command. mysql -u [username] -p newdatabase < [database name].sql;

  1. Clone/Extract the Source code.

Clone or extract the source code of magento 2.

  1. Run Composer Install Or Composer Update Command :

Run the composer update command, If composer is not installed then run first composer install & then composer update command. (If you get any memory limit error then run COMPOSER_MEMORY_LIMIT=-1 composer update command.)

  1. Create env.php file : Run this command to create env.php file.

php bin/magento setup:config:set --db-user="dbusername" --db-password="dbpassword" --db-name="dbname" or add any existing env.php file and update the host, dbname, username & password.

  1. Create config.php file : Run this command to create config.php file.

php bin/magento module:enable --all

  1. Run the following commands one by one :

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

  1. Change the base url in database :

Table name : core_config_data

path : web/unsecure/base_url
path : web/secure/base_url

Or you can change by using below commands.

php bin/magento setup:store-config:set --base-url=""

php bin/magento setup:store-config:set --base-url-secure=""


  1. Clean and Flush the cache :

php bin/magento cache:clean and php bin/magento cache:flush.

  1. Now open url in browser.

🙂 Happy Coding. Keep Liking & Sharing 💻

Tagged , ,