cancel
Showing results for 
Search instead for 
Did you mean: 

SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

Hi!

My site was down yesterday for around 600 minutes due to error. Have you encountered a similar problem. How have you resolved it. Thanks. 

a:5:{i:0;s:63:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away";i:1;s:6343:"#0 /home/rocknshop/web/rocknshop.com/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/rocknshop/web/rocknshop.com/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/rocknshop/web/rocknshop.com/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `directo...', Array)
#4 /home/rocknshop/web/rocknshop.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `directo...', Array)
#5 /home/rocknshop/web/rocknshop.com/public_html/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Directory/Model/Resource/Currency.php(240): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select), Array)
#7 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Directory/Model/Resource/Currency.php(217): Mage_Directory_Model_Resource_Currency->_getRatesByCode('USD', Array)
#8 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Directory/Model/Currency.php(342): Mage_Directory_Model_Resource_Currency->getCurrencyRates('USD', Array)
#9 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Directory/Block/Currency.php(64): Mage_Directory_Model_Currency->getCurrencyRates(Object(Mage_Directory_Model_Currency), Array)
#10 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Directory/Block/Currency.php(44): Mage_Directory_Block_Currency->getCurrencies()
#11 /home/rocknshop/web/rocknshop.com/public_html/app/design/frontend/zonda/default/template/directory/currency.phtml(8): Mage_Directory_Block_Currency->getCurrencyCount()
#12 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(241): include('/home/rocknshop...')
#13 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/zonda/...')
#14 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#15 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#16 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#17 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('currency', true)
#18 /home/rocknshop/web/rocknshop.com/public_html/app/design/frontend/zonda/default/template/page/html/header.phtml(133): Mage_Core_Block_Abstract->getChildHtml('currency')
#19 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(241): include('/home/rocknshop...')
#20 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/zonda/...')
#21 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#22 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#23 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#24 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('header', true)
#25 /home/rocknshop/web/rocknshop.com/public_html/app/design/frontend/zonda/default/template/page/1column.phtml(58): Mage_Core_Block_Abstract->getChildHtml('header')
#26 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(241): include('/home/rocknshop...')
#27 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/zonda/...')
#28 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#29 /home/rocknshop/web/rocknshop.com/public_html/app/code/community/MageWorx/SeoBase/Block/Page/Html.php(16): Mage_Core_Block_Template->_toHtml()
#30 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): MageWorx_SeoBase_Block_Page_Html->_toHtml()
#31 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#32 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#33 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#34 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#35 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#36 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#37 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#38 /home/rocknshop/web/rocknshop.com/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#39 /home/rocknshop/web/rocknshop.com/public_html/app/code/local/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#40 /home/rocknshop/web/rocknshop.com/public_html/app/Mage.php(685): Mage_Core_Model_App->run(Array)
#41 /home/rocknshop/web/rocknshop.com/public_html/index.php(122): Mage::run('international_v...', 'store')
#42 {main}";s:3:"url";s:45:"/women/bags/jean-striped-box-clutch-4230.html";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:18:"international_view";}

5 REPLIES 5

Re: SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

Hi @neeraj _moorjani

 

The usual cause when you get MySQL server has gone away is timeout errors and max_allowed_packet being set too low.

 

Check your my.cnf file for below configuration and its value at least should be like below :

 

 

max_allowed_packet = 16M
wait_timeout = 1800 
connect_timeout = 120


Also this is reported and known issue , so you can refer this link for the same - https://magento.stackexchange.com/questions/42176/geting-fatal-error-sqlstatehy000-general-error-200...

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

Kindly refer below links to solve your issue,

https://magento.stackexchange.com/questions/9007/magento-mysql-has-gone-away-error#answer-9016

 

https://stackoverflow.com/questions/30544913/sqlstatehy000-general-error-2006-mysql-server-has-gone-...

 

https://www.yireo.com/tutorials/magento/magento-administration/1284-mysql-server-has-gone-away

 

Fix:

Try increasing the value of wait_timeout variable in your MySQL's my.ini file.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

Currently  the settings are hereunder. 

 

max_allowed_packet = 2GB
wait_timeout = 160000

Re: SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

Hi!

 

Facing the same (or very similar issue)... I get emails with the following content for my Magento 1.9. store:

 

Error:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away, query was: SELECT `cms_page`.* FROM `cms_page`  INNER JOIN `cms_page_store` ON cms_page.page_id = cms_page_store.page_id WHERE (`cms_page`.`identifier`='home') AND (is_active = 1) AND (cms_page_store.store_id IN (0, 1)) ORDER BY `cms_page_store`.`store_id` DESC LIMIT 1

 

Trace:

#0 /home/XXXXXXX/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

#1 /home/XXXXXXX/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

#2 /home/XXXXXXX/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)

#3 /home/XXXXXXX/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `cms_pag...', Array)

#4 /home/XXXXXXX/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `cms_pag...', Array)

#5 /home/XXXXXXX/public_html/lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)

#6 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(380): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))

#7 /home/XXXXXXX/public_html/app/code/core/Mage/Cms/Model/Resource/Page.php(170): Mage_Core_Model_Resource_Db_Abstract->load(Object(Mage_Cms_Model_Page), 'home', 'identifier')

#8 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Cms_Model_Resource_Page->load(Object(Mage_Cms_Model_Page), 'home', NULL)

#9 /home/XXXXXXX/public_html/app/code/core/Mage/Cms/Model/Page.php(113): Mage_Core_Model_Abstract->load('home', NULL)

#10 /home/XXXXXXX/public_html/app/code/core/Mage/Cms/Helper/Page.php(74): Mage_Cms_Model_Page->load('home')

#11 /home/XXXXXXX/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(SkyMagento_Redirect_IndexController), 'home')

#12 /home/XXXXXXX/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(SkyMagento_Redirect_IndexController), 'home')

#13 /home/XXXXXXX/public_html/app/code/local/SkyMagento/Redirect/controllers/IndexController.php(15): Mage_Cms_IndexController->noRouteAction(NULL)

#14 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): SkyMagento_Redirect_IndexController->noRouteAction()

#15 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('noRoute')

#16 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))

#17 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()

#18 /home/XXXXXXX/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)

#19 /home/XXXXXXX/public_html/index.php(83): Mage::run('', 'store')

#20 {main}

 

I've tried several possible solutions, including increasing wait_timeout and max_allowed_packet in my.cnf with no success.

 

Any help appreciated! 

 

Re: SQLSTATE [HY000]: General error: 2006 MySQL server has gone away

I have the same issue.

 

It's too early to make my final judgement. But I'm using this plugin:

https://marketplace.magento.com/absolute-absolute-geoip.html

This plugin connects to: 

http://ip2c.org/

 

I have noticed that sometimes this service goes down. Making the curl job (with a default timeout of 2 minutes) wait beyond the wait_timeout of the mysql server. So mysql kills the connection. After two minutes the curl job finishes and tries to execute the rest of the code.

 

Resulting in using a connection lost.

 

So if your scripts opens a connection, then relies on a curl response and then tries to use that initial connection, be sure to put a CURLOPT_TIMEOUT to prevent endless waiting