Suppose you have only access of FTP and cPanel and you were not given which database is used in current project of magento. In that mean time how can a developer would get know which database has been use for magento site.Generally Magento database connection details can be found from local.xml file if you navigate app/etc/local.xml directory.Generally local.xml contains environment dependent settings like DB connection, cache engine, encryption key, session handler etc.So in local.xml file we will be getting all database connection details if we go through it.
Below xml file clearly explains all related values.If you thoroughly view then you will get all your requirement for accessing your database like which database has used and what are the credentials etc.Below code contains some values like
- table_prefix: ”
- host: ‘localhost’
- username: ‘root’
- password: ”
- dbname: ‘magento’
You can change as per your server.
You can get Magento database connection details through above code but you can create custom script to get database details as well.You can check below code that I had used in one of my project to get Magento database connection details.You can use this if you are not sure in case of local.xml file.Obviously if this script give you the same result with local.xml file then you will be sure yes I am using this database with these credentials.You can place this custom script in root directory of you magento installation and run through browser then you will be getting all details of your database.
Hope you enjoyed the article and never forget to share to help others.