Magento has transformed into an enhanced eCommerce platform with the launch of Magento 2. With the introduction of performance and security-related features, Magento 2 has brought some changes in the file structure too. This tutorial will guide you on how to fetch details about the database configuration file in Magento 2.
In the previous version of Magento, the database configuration file was app/etc/local.xml, whereas, in Magento 2, the file address is app/etc/env.php
Magento 2 Database Configuration File
You need to edit the file below in order to change the database server hostname, database username, password, or database name in Magento 2.
/<Magento Install Dir>/app/etc/env.php
Find the Magento 2 installation directory with the help of the above link and edit the configuration file that is located on
app/etc/env.php. You can continue with the settings and mandatory changes in an editor you like the most.
'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'Your MySQL server hostname',
'dbname' => 'database_name',
'username' => ''MySQL username server to connect database',
'password' => 'MYSQL server database password',
'active' => '1',
),
),
),
Image source: livetiles
Don't forget to save changes when you are done.