I want to connect my Magento 2 to a new database, I've updated the /app/etc/env.php What other steps do I need to take

1 Answer 1


The following steps, you need to perform to properly replace the database:

  • Change connectivity parameters for the new database in app/etc/env.php
  • Check and correct base URLs in the core_config_data table in the new database.
  • Since there may be a difference in the entries of setup_module table, you must run php bin/magento setup:upgrade to map all existing modules (with correct version) to the new database.

Note that above steps are necessary. Below steps may be optional:

  • Clean cache.
  • Compile and deploy the static content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.