1

I had some issues with my local dev version of my Magento 1 website so I copied all the files from the live site to my local and broke it :-/

I'm now getting database access errors as below: Can anyone help out please? 'myusername' is in place of my real username 'mywebsite' is in place of my real website name

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

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

First you need to export your database from live site and import to your local machine server.
Then go to app/etc/local.xml file and update below code as per your local machine's Database details.

<connection>
    <host><![CDATA[localhost]]></host> <!-- YOUR DB HOSTNAME -->
    <username><![CDATA[root]]></username> <!-- YOUR DB USERNAME -->
    <password><![CDATA[]]></password> <!-- YOUR DB PASSWORD, LEAVE BLANK IF NO PASSWORD REQUIRED -->
    <dbname><![CDATA[magento1800]]></dbname> <!-- YOUR DB NAME -->
    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
    <model><![CDATA[mysql4]]></model>
    <type><![CDATA[pdo_mysql]]></type>
    <pdoType><![CDATA[]]></pdoType>
    <active>1</active>
</connection>

Once done, Go to phpmyadmin, Open your database and modify core_config_data table, Update rows where path value

web/unsecure/base_url set to http://YOUR_SITE_LOCAL_URL/

web/secure/base_url set to https://YOUR_SITE_LOCAL_URL/

Clear var/cache and var/session folders.

  • 1
    If it helped, just mark this answer as correct by clicking on tick mark beside the answer so it may help others find the correct solution if they are facing similar issue. – Jaimin Sutariya Apr 10 '17 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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