0

I copied a magento 1.9 installation from one host to a new. Then when I try activating the new installation I get a database error:

SQLSTATE[28000] [1045] Access denied for user 'testadmin'@'localhost' (using password: YES)

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

Can I reinstall or just set the db password somewhere?

1

1 Answer 1

1

The database credentials are found in app/etc/local.xml

Set them to the login name, password and database on the current machine.

The section you're looking for looks like this:

    <resources>
        <db>
            <table_prefix><![CDATA[]]></table_prefix>
        </db>
        <default_setup>
            <connection>
                <host><![CDATA[localhost]]></host>
                <username><![CDATA[namehere]]></username>
                <password><![CDATA[passhere]]></password>
                <dbname><![CDATA[dbnamehere]]></dbname>
                <active>1</active>
            </connection>
        </default_setup>
    </resources>

This is assuming you have already gone into cPanel or phpMyAdmin and created a user account, created a database, assigned the user to the database and imported your database contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.