Magento Database Configuration file – DB connnection

Here in this article we’ll learn to access Mage DB Configure File. Also known as the Magento Database connection file. However, we need to edit or re code the file several times to make changes in to our live server site.

As we already know any mistake can lead to connection errors and sometimes cause our site to eventually crash. So our Aspiration clients are requested to contact our live tech team for 24×7 tech support using client login area. Enjoy Aspiration CDN, SSD cloud storage & LiteMagecache premium features for only $9.99 per month which is a basic Mage cloud hosting plan.

Tanzia Farin Chy   for Aspiration hosting  

Mage DB configuration – Magento Database connection file

Hence we’re already aware about the MySQL Maria DB. To make any changes in our DB the MySQL plays a very important role. Such as backing up DB, updating DB and changing name of different tables etc. Also sometimes we need to edit our hostname, username and password which are impossible without the MySql platform.

By the way to make any changes in the DB we must have the DB credentials. In case we don’t have the credentials and have the FTP details only. At that point we must have the Mage DB access details to make changes in DB.

In case you don’t know database credentials, but have FTP access you need to find Mage DB access details.
Here following is the path to consider to reach the Mage DB CONFIG file:

Magento 1x – //app/etc/local.xml;
Magento 2x – //app/etc/env.php, edit env.php

Magento Database connection file – Magento 1x version

Now by accessing in the Mage installation DIR we can edit the local.xml file using any of the best text editor. Here you can see the codes that connect MySQL DB with live Mage site. So, it is also named as Magento Database connection file. For example, the codes looks like following:

<connection>

<host><![CDATA[localhost]]></host>

<username><![CDATA[asp_admin]]></username>

<password><![CDATA[asp_password]]></password>

<dbname><![CDATA[asp_ecommerce]]></dbname>

<active>1</active>

</connection>

Here we used asp_admin as our but you can use something own between the third parenthesis. So that is how we can change our connection parameters using Mage DB config file.

Magento Database connection file – Magento 2x version

Similarly go to the path above mentioned for the Magento 2x or later version to reach the env.php file. Here the code looks like the following:

‘db’ =>
array (
‘table_prefix’ => ‘‘ ,
‘connection’ =>
array (
‘default’ =>
array (
‘host’ => ‘localhost’,
‘dbname’ => ‘asp_ecommerce’,
‘username’ => ‘asp_admin’,
‘password’ => ‘asp_password’,
‘active’ => ‘1’,
),
),
),

Finally after we do have finished and assigned new values to our DB config file, save the changes. Also we can track the log activity to verify that the changes have been made in to the DB.