2013-04-21 60 views
0

我有一個EC2大型實例的magento網站,RDS上的數據庫又是一個大型實例。 現在, 1.網站上最多有25人流量。 2.我正在面對下面的SQL錯誤及時,它出現後有時6-7小時或有時後一天,任何人都可以幫助我呢? 3.爲了擺脫這個錯誤,我重新啓動服務,並且它恢復正常,但之後有一次這個錯誤再次彈出!Magento -SQL 2002錯誤

出現了一個錯誤處理您的請求 SQLSTATE [HY000] [2002]連接超時

跟蹤:

#0 /opt/bitnami/apps/magento/htdocs/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect() 
#1 /opt/bitnami/apps/magento/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(313): Zend_Db_Adapter_Pdo_Mysql->_connect() 
#2 /opt/bitnami/apps/magento/htdocs/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect() 
#3 /opt/bitnami/apps/magento/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array) 
#4 /opt/bitnami/apps/magento/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array) 
#5 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8') 
#6 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element)) 
#7 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write') 
#8 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write') 
#9 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter() 
#10 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(360): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter() 
#11 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(134): Mage_Core_Model_Resource_Db_Abstract->getReadConnection() 
#12 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Config.php(1348): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website)) 
#13 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Config.php(1380): Mage_Core_Model_Config->getModelInstance('core_resource/w...', Object(Mage_Core_Model_Resource_Website)) 
#14 /opt/bitnami/apps/magento/htdocs/app/Mage.php(490): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Resource_Website)) 
#15 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Abstract.php(208): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Resource_Website)) 
#16 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection() 
#17 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/App.php(608): Mage_Core_Model_Abstract->getCollection() 
#18 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores() 
#19 /opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store') 
#20 /opt/bitnami/apps/magento/htdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array) 
#21 /opt/bitnami/apps/magento/htdocs/index.php(86): Mage::run('', 'store') 
#22 {main} 

回答

0

這是一些數據庫連接錯誤。檢查本地xml文件的數據庫連接設置。您的數據庫是在同一臺服務器上,否則使用套接字

+0

不,它在RDS上託管!自從我將數據庫從服務器移動到RDS後,我一直面臨着這個問題! – user2304710 2013-04-24 05:28:03

0

我在RDS實例上遇到同樣的問題。通過同一臺服務器上的單獨文件檢查連接。

$link = mysqli_connect("host", "username", "password", "database"); 

if (!$link) { 
    echo "Error: Unable to connect to MySQL." . PHP_EOL; 
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; 
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; 
    exit; 
} 

echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL; 
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL; 

mysqli_close($link);