<default_setup>
<connection>
<host><![CDATA[10.1.39.35]]></host>
<username><![CDATA[user]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[db_magento]]></dbname>
<active>1</active>
</connection>
</default_setup>
我的local.xml文件配置如上所示。 我收到此错误
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Trace:
#0 /home/ecosmart/public_html/e-nrg.com/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/ecosmart/public_html/e-nrg.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(251): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/ecosmart/public_html/e-nrg.com/lib/Zend/Db/Adapter/Abstract.php(448): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/ecosmart/public_html/e-nrg.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/ecosmart/public_html/e-nrg.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php(45): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Resource.php(93): Mage_Core_Model_Resource_Type_Db_Pdo_Mysql->getConnection(Object(Mage_Core_Model_Config_Element))
#7 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(297): Mage_Core_Model_Resource->getConnection('core_read')
#8 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(312): Mage_Core_Model_Mysql4_Abstract->_getConnection('read')
#9 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Mysql4/Cache.php(41): Mage_Core_Model_Mysql4_Abstract->_getReadAdapter()
#10 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Cache.php(424): Mage_Core_Model_Mysql4_Cache->getAllOptions()
#11 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Cache.php(459): Mage_Core_Model_Cache->_initOptions()
#12 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/App.php(1101): Mage_Core_Model_Cache->canUse('config')
#13 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Config.php(404): Mage_Core_Model_App->useCache('config')
#14 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/Config.php(286): Mage_Core_Model_Config->_canUseCacheForInit()
#15 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/App.php(359): Mage_Core_Model_Config->loadModulesCache()
#16 /home/ecosmart/public_html/e-nrg.com/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initModules()
#17 /home/ecosmart/public_html/e-nrg.com/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#18 /home/ecosmart/public_html/e-nrg.com/index.php(83): Mage::run('', 'store')
#19 {main}
我一直在网上寻找,我找不到有这个问题的人=每个人都说当他们在不同的端口上运行他们的本地mysql时会发生这种情况。我不是,我正在运行一个单独的服务器,其中包含通过内部网络联网的数据库。
是否有人知道使用MYSQL套接字连接阻止magento并强制它使用TCP协议的解决方法?
由于
答案 0 :(得分:2)
你清理缓存了吗? rm -rf var/cache
答案 1 :(得分:1)