Magento 1 & Magento 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 DB config file go to:

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

Magento db config 1

  • 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:

Magento db config 2

  • check all the values you need: 






Don’t forget to save the updates.

We don't recommend using object manager to get system config value in phtml files, because it's not the best coding practice. 

More often than not there are cases when unwanted changes have already been implemented but nobody from the store admins knows what triggered them. To avoid the cases in the future, we offer the Magento 2 Admin Actions Log extension. Automatically track all logged actions, store logged data for a predefined period, get notifications on unauthorized login attempts and keep your store secure.

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.