Reputation: 3184
I've been trying now for a few hours to move our Magento installation from dev to live. I found multiple links on the web saying that to move a Magento Installation you need to edit /app/etc/local.xml
and update it with the new MySQL credentials and then delete the contents of /var/cache/
(a few even suggested deleting the whole /var
folder. I also deleted the contents of /var/session/
. Our server is NOT cached (no memcached, varnish, etc). I even restarted apache to see if I could flush any cache that might be running.
So the problem is our Magento installation is still attempting to connect to the old database somehow. We are given this error:
SQLSTATE[28000] [1045] Access denied for user 'oldDBUsername'@'localhost' (using password: YES)
If anyone has any ideas on how to fix this that I haven't already mentioned it would be greatly appreciated.
EDIT:
Here is the stack trace that Magento also reports:
Trace:
#0 fileroot/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 fileroot/lib/Varien/Db/Adapter/Pdo/Mysql.php(300): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 fileroot/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 fileroot/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 fileroot/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 fileroot/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 fileroot/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 fileroot/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_read')
#8 fileroot/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getConnection('read')
#9 fileroot/app/code/core/Mage/Core/Model/Resource/Cache.php(53): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#10 fileroot/app/code/core/Mage/Core/Model/Cache.php(449): Mage_Core_Model_Resource_Cache->getAllOptions()
#11 fileroot/app/code/core/Mage/Core/Model/Cache.php(491): Mage_Core_Model_Cache->_initOptions()
#12 fileroot/app/code/core/Mage/Core/Model/App.php(1175): Mage_Core_Model_Cache->canUse('config')
#13 fileroot/app/code/core/Mage/Core/Model/Config.php(414): Mage_Core_Model_App->useCache('config')
#14 fileroot/app/code/core/Mage/Core/Model/Config.php(294): Mage_Core_Model_Config->_canUseCacheForInit()
#15 fileroot/app/code/core/Mage/Core/Model/App.php(408): Mage_Core_Model_Config->loadModulesCache()
#16 fileroot/app/code/core/Mage/Core/Model/App.php(338): Mage_Core_Model_App->_initModules()
#17 fileroot/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#18 fileroot/index.php(80): Mage::run('', 'store')
#19 {main}
Upvotes: 2
Views: 13011
Reputation: 335
Also changing my file names in app/etc/
removing the .xml in the middle worked for me:
local.xml.template
to local.template
and local.xml.additional
to local.additional
Thanks @Peter.
Upvotes: 0
Reputation: 1
Your answer saved me! I spent a lot of time on this issue and only stumbled on this answer. I usually copy and paste to search for the error, so I wanted to give more of the actual error so that others could benefit.
I named my local.xml file to local.bak and that's where my mistake was. Comparison against all files of a working Magento instance yielded only the extra file.
The error led me to believe that maybe mySQL was the issue but it had nothing to do with it. Perhaps someone might be able to post a log or method that shows what file is actually being used. I didn't see any notice written to any log.
Here is more of the error, excluding anything site specific:
"SQLSTATE[HY000] [1045] Access denied for user '*myuser*'@'localhost' (using password: YES) /lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
Upvotes: 0
Reputation: 1
For others having this issue in the future here is some documentation on Magento's wiki. http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server
Upvotes: 0
Reputation: 3184
I figured it out.
When I brought over the dev installation to live I had copied local.xml
to local_bk.xml
I discovered that Magento will attempt to autoload ALL xml files in the /app/etc/
folder so it was trying to load my backed up file, soon as I renamed my backup to something that didn't end in .xml it worked.
Upvotes: 12
Reputation: 3568
When you install magento you have to select whether cache and session data is stored on the file system or db.
It may be the following line in local.xml, cant quite remember right now.
<session_save><![CDATA[files]]></session_save>
if you are using the db then it stores data in the core_cache table maybe in the database.
See if your db cache tables are empty if they are not truncate them.
You will also need to update your base url both secure and unsecure in core_config_data
see the following for SQL to do the update
Upvotes: 2
Reputation: 795
Within your magento folder you need to edit app/etc/local.xml as Gershon mentioned.
You will also as root or sudo need to remove all files and directories in your magento folder's var/cache that magento creates.
Upvotes: -1
Reputation: 3064
The correct path is
app/etc/local.xml
instead of:
etc/app/local.xml
Does this solve your issue?
Upvotes: 0