Developers often have to do some work related to database, such as backups, database edits, etc. But usually the clients don’t even know what is MySQL database and where to get the database access details, they usually give just FTP or hosting control panel access.

Even if you have access to hosting cPanel, there might be a number of databases and you might need just one database related to a certain website/application. For example: magento.

So, let’s assume we have FTP access and we don’t know the database credentials, but we need to perform a database backup. Where do we find the database access details?

Go to ‘/app/etc/’ directory and open the file ‘local.xml’.

            <default_setup>
                <connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[magento]]></username>
                    <password><![CDATA[magento]]></password>
                    <dbname><![CDATA[magento]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>

Here you can see all the data u need:
see host, username, password and the dbname nodes in the xml structure.

So, you may use the phpminiadmin script to make a backup, just enter appropriate db credentials.

Another common case – is the website transfer. After you transfer magento files and database to the new host, just correct the /app/etc/local.xml file to the new database access credentials if the database host/user/password or the db name changes on the new server.