Magento 1&2 database config file: Where to find it and how to edit

In view of backups, database edits, server hostname, username, password or database name alterations you need to work with MySQL.

In case you don’t know database credentials, but have FTP access you need to find Magento database access details.

To get Magento 1 configuration file go to:

  •  /<Magento Install Dir>/app/etc/local.xml;
  • having accessed Magento installation directory, edit local.xml file using your number-one editor and find the next settings:

Magento db config 1

  • renew the needed values:

<host>

<username>

<password>

<dbname>

 

Once the changes are made, save the newly assigned values.

 

To get Magento 2 configuration file go to:

  • /<Magento Install Dir>/app/etc/env.php, edit env.php configuration file and look for the following settings for making the required changes:

Magento db config 2

  • check all the values you need: 

'host'

'dbname'

'username'

'password'

 

Don’t forget to save the updates.

 

!!! Having dealt with migration, all the values should be adjusted to the new database information. 

 

Rate the answer?