How to change mysql credentials in Magento

This probably seems like a no-brainer for many people, but it came up today and I didn’t have an immediate answer.  So, if you want to change any of your MySQL database access settings (like your database name, database username, database password or database host), you’ll need to do it within the following file:


Once you open that file, you’ll see it’s very basic and if you’re playing with Magento’s code, you should have no problem making the necessary changes there. But for reference, here’s the code block that needs to be altered:


Make sure to keep the structure in place there. only change the values within the CDATA brackets.

Written by Arvind Bhardwaj

Arvind is a certified Magento 2 expert with more than 10 years of industry-wide experience.