Magento 2 Database Configuration File

Magento 2 is latest version available of the popular eCommerce software Magento. In previous tutorial you got details about Magento2 installation on Linux. This tutorial you will get details about Magento 2 database configuration file. In older version database configuration file was app/etc/local.xml but in Magento2 this configuration is located in app/etc/env.php.

Magento 2 Database Configuration File

To change your Magento 2 database server hostname, database username, password or database name, you need to edit below file.
/<Magento Install Dir>/app/etc/env.php 
Navigate to your Magento 2 installation directory and edit app/etc/env.php configuration file in your favorite editor and search for following settings and do necessary changes.
   'db' =>   array (     'table_prefix' => '',     'connection' =>     array (       'default' =>       array (         'host' => 'localhost',         'dbname' => 'database_name',         'username' => 'database_username',         'password' => 'database_password',         'active' => '1',       ),     ),   ),  
Now update the orange highlighted values as following
  • localhost : MySQL server hostname.
  • database_username : MySQL user to connect database server.
  • database_password : MySQL user password .
  • database_name : MySQL database name of magento.

Thanks for Visit Here

Comments