You can get the Magento database configuration by using custom PHP script in Magento given below:
<?php
define('MAGENTO_ROOT', getcwd());
require_once MAGENTO_ROOT . '/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
);
$host = $dbInfo["host"]; // will provide host name
$user = $dbInfo["user"]; // will provide user name
$password = $dbInfo["pass"]; // will provide database password
$dbName = $dbInfo["dbname"]; // will provide database name
?>
Like this:
Like Loading...