Get database connection details Magento

Hello Friends

If you want to get database details in magento then you can use my below script

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

Let me know if you have any query