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:

/app/etc/local.xml

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:

<host><![CDATA[HOSTNAME]]></host>
<username><![CDATA[USER]]></username>
<password><![CDATA[PASSWORD]]></password>
<dbname><![CDATA[DATABASENAME]]></dbname>

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.

Website: http://www.webspeaks.in/