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:

renew the needed values:





Once the changes are made, save the newly assigned values. To monitor all the backend activities, apply Magento access logs.

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

  • check all the values you need: 





 Don’t forget to save the updates. 

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