Magento 2 Database Configuration File

As Magento2 has recently launched and most of the people ask about its database configuration when migrate on Magento2,So In this tutorial we will give you details about Magento 2 configuration file.

In Magento 1.0, the configuration file is available in:

/app/etc/local.xml

In Magneto2 configuration file is in same directory but has been renamed with env.php.

The file path is as follows:

/app/etc/env.php

In this file many other configuration variables include like you can change the database table prefix as it’s very helpful if you want to use single database for multiple installations like WordPress, Joomla etc. 

'db'=>   
array (  
'table_prefix' => '',  
'connection' =>   
array (  
'default' =>   
array (  
'host' => 'localhost',  
'dbname' => 'magento2',  
'username'=> 'root',  
'password'=> 'YOUR_DB_PASSWORD',  
'active'=> '1',  
),  
),  
),

Also in this file you can define the admin panel URL, by default its admin but you can change it so that hackers can’t access it easily.

'backend' =>   
array (  
'frontName' => 'admin',  
),  

Magento 2 also allows you to specify what types of caching are enabled in the system by changing values in configuration file.

'cache_types'=>   
array (  
'config' => 1,  
'layout' => 1,  
'block_html' => 1,  
'collections' => 1,  
'db_ddl' => 1,  
'eav' => 1,  
'full_page' => 1,  
'translate'=> 1,  
'config_integration'=> 1,  
'config_integration_api'=> 1,  
'config_webservice'=> 1,  
)

That’s all about Magento2 database configuration file.

Give your opinion below if you experience any issues or to discuss your ideas and experiences.

Leave a Reply