Find the MySQL Database details for Wordpress, Joomla, Prestashop and Magento and others
If your website is experiencing a MySQL database connection error, it's often because your website's configuration file has the wrong password listed, and you simply need to update the details. This guide shows you how to find this configuration file in various CMS's/Web Builders. Once you've found your MySQL password and user details, click on this guide for instructions on updating them.
NOTE: Your main website's root folder will always be the public_html folder. However, if the domain in question is an add-on domain or subdomain it will have its own root folder inside the main public_html folder. For example, the "public_html" folder of the subdomain testing.yourdomain.net.au will be public_html/testing/.(click here for a guide on finding the correct folder in this case)
wp-config.php this file is located in your public_html folder. The information you need will look like this:
settings.inc.php this file is located in the public_html/config/ folder. The information you need will look like this:
configuration.php this file is located in the public_html folder. The information you need will look like this:
settings.php this file is located in the public_html/sites/default/ folder. The information you need will look like this:
local.xml this file is located in the public_html/app/etc/ folder. The information you need will look like this:
If your CMS isn't listed here (or your site is custom made) and you can't find the config file name by doing a Google search for cms name config file (eg: magento config file), alternatively you can log into your website via SSH and search for part of the database using the below command:
egrep -r DBNAME *
This will find a list of text documents which contain your database name in them. With cPanel for example, the database name will start with the username. So if your cPanel username is yourdom then you would use the command: egrep -r yourdom *
Of course, if you have multiple CMS's installed in different sub/add-on directories, it will find them all and you will have to check the files to find the correct one.