0

9.3.6 website. It works fine but sometime it shows SQL error and sometimes it shows many times in a day. here is its trace records

SQLSTATE[HY000] [2002] Connection refused

Trace:
#0  /public_html/ocb/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1  /public_html/ocb/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2  /public_html/ocb/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3  /public_html/ocb/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4  /public_html/ocb/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5  /public_html/ocb/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6  /public_html/ocb/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7  /public_html/ocb/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#8  /public_html/ocb/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9  /public_html/ocb/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10  /public_html/ocb/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(360): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11  /public_html/ocb/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(134): Mage_Core_Model_Resource_Db_Abstract->getReadConnection()
#12  /public_html/ocb/app/code/core/Mage/Core/Model/Config.php(1357): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website))
#13  /public_html/ocb/app/code/core/Mage/Core/Model/Config.php(1389): Mage_Core_Model_Config->getModelInstance('core_resource/w...', Object(Mage_Core_Model_Resource_Website))
#14  /public_html/ocb/app/Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#15  /public_html/ocb/app/code/core/Mage/Core/Model/Abstract.php(208): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#16  /public_html/ocb/app/code/core/Mage/Core/Model/Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()
#17  /public_html/ocb/app/code/core/Mage/Core/Model/App.php(619): Mage_Core_Model_Abstract->getCollection()
#18  /public_html/ocb/app/code/core/Mage/Core/Model/App.php(477): Mage_Core_Model_App->_initStores()
#19  /public_html/ocb/app/code/core/Mage/Core/Model/App.php(360): Mage_Core_Model_App->_initCurrentStore('', 'store')
#20  /public_html/ocb/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21  /public_html/ocb/index.php(83): Mage::run('', 'store')
#22 {main}

please give me proper solution so that i can fix this.

Thanks in advance.

  • check you mysql configuration. – kunj Jun 5 '18 at 6:59
  • 1
    what to need in check in mysql configuration we got this limitations from our dedicated server with 8 GB ram - a single mysql connection will wait 7800 to expire. have set wait_timeout=300 and already max_allowed_packet=256M only in the server So server saying in your site there are more then 20,000 mysql quries running thats why getting this issue they are saying optimize your database but this is magento default database and we just installed theme there is also prbm with products indexing we have uploaded 50k products there but now we cross all mysql limits, so please help to short out – Gauri Shankar Prajapati Jun 5 '18 at 7:05
  • have you enabled flat? – kunj Jun 5 '18 at 8:09
  • yes already enabled – Gauri Shankar Prajapati Jun 5 '18 at 13:33
0

Renaming the file app/etc/env.php helped me

|improve this answer|||||

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.