search
top

Get database connection details in Magento

I am writing here an important code snippet for getting the database connection details used in Magento

$config  = Mage::getConfig()->getResourceConnectionConfig("default_setup");
		$_host = $config->host;
		$_uname = $config->username;
		$_pass = $config->password;
		$_dbname = $config->dbname;
		echo $_host; ///likewise

7 Responses to “Get database connection details in Magento”

  1. Rat says:

    Or you could lookup the database/details from the backend/cpanel.

  2. Thanks, perhaps better instruction on how to implement it for those who don’t know…

  3. […] I am writing here an important code snippet for getting the database connection details used in Magento ? […]

  4. Manish Kumar says:

    Hey,

    Thanks man for the quick tips on Magento.
    Keep up the good work.

    Thanks

Leave a Reply

top