Magento Tutorials

How to Edit Magento Database Configuration File

When you need to install or change the hosting server for a website, the step of editing Magento Database Configuration File is inevitable. Here’s how you can easily get the job done via these Magento tutorials.

From the root of your Magento directory, follow this path: <Magento Install Dir>/app/etc/, and edit env.php In this file, you’ll find all the information related to your database configuration in the 'db' node.

Database configurations Magento 2
Database configurations are stored in the ‘db’ node

From here, you can edit various values related to your database configuration such as:

  • host: your host address
  • dbname: the name of Magento website database
  • username & password: account information that has access to dbname

After you’re done configuring, remember to save the file and clear your cache by going into your Magento backend and choose System > Tools > Cache Management.> Flush Magento Cache. 

Hope that helps!

Recommended posts:
How to use Magento Database Repair Tool
How Magento Database Structure will “take over” your job
How to Create the Magento Database Schema


A knowledge craver who always strive to be wiser everyday.

Notify of

Inline Feedbacks
View all comments