How can I fix this error I received after migrating my Magento site to new server?

by Jared Chesebro   Last Updated April 18, 2018 01:09 AM

SQLSTATE[42000] [1044] Access denied for user 'db_user'@'localhost' to database 'database_db'

Trace:
#0 /home/account/sitename/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/account/sitename/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/account/sitename/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/account/sitename/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/account/sitename/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/account/sitename/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/account/sitename/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /home/account/sitename/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#8 /home/account/sitename/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9 /home/account/sitename/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10 /home/account/sitename/app/code/core/Mage/Core/Model/Resource/Cache.php(53): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11 /home/account/sitename/app/code/core/Mage/Core/Model/Cache.php(478): Mage_Core_Model_Resource_Cache->getAllOptions()
#12 /home/account/sitename/app/code/core/Mage/Core/Model/Cache.php(520): Mage_Core_Model_Cache->_initOptions()
#13 /home/account/sitename/app/code/core/Mage/Core/Model/App.php(1202): Mage_Core_Model_Cache->canUse('config')
#14 /home/account/sitename/app/code/core/Mage/Core/Model/Config.php(414): Mage_Core_Model_App->useCache('config')
#15 /home/account/sitename/app/code/core/Mage/Core/Model/Config.php(294): Mage_Core_Model_Config->_canUseCacheForInit()
#16 /home/account/sitename/app/code/core/Mage/Core/Model/App.php(424): Mage_Core_Model_Config->loadModulesCache()
#17 /home/account/sitename/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#18 /home/account/sitename/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#19 /home/account/sitename/index.php(83): Mage::run('', 'store')
#20 {main}


Answers 1


Error seems to be consistent with incorrect database configuration.

Open app/etc/local.xml file and check database details,

<host><![CDATA[yourhostname]]></host>
<username><![CDATA[databaseusername]]></username>
<password><![CDATA[databasepassword]]></password>
<dbname><![CDATA[databasename]]></dbname>

Input your correct database details and refresh.

Suresh Chikani
Suresh Chikani
November 17, 2016 17:09 PM

Related Questions



Magento 1 and 2 extensions

Updated October 04, 2017 05:09 AM


Admin Dashboard Error

Updated February 26, 2017 13:09 PM