Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get magento database details [closed]

Tags:

php

magento

I want to get magento's database configuration in any file within magento.

How do I do this?

like image 674
Bharat Chodvadiya Avatar asked Jun 12 '12 07:06

Bharat Chodvadiya


1 Answers

Magento connection details u find out to below method..........

require_once ('../app/Mage.php');
$app = Mage::app('default');

$config  = Mage::getConfig()->getResourceConnectionConfig('default_setup');

$dbinfo = array('host' => $config->host,
            'user' => $config->username,
            'pass' => $config->password,
            'dbname' => $config->dbname
);

$hostname = $dbinfo['host'];
$user = $dbinfo['user'];
$password = $dbinfo['pass'];
$dbname = $dbinfo['dbname'];
like image 124
hemant patel Avatar answered Oct 22 '22 09:10

hemant patel