Magento – Too many connections error

databasemagento-1.9

I am using Magento 1.9.1 with all patches installed on a windows machine and i'm getting this error

a:4:{i:0;s:43:"SQLSTATE[08004] [1040] Too many connections";i:1;s:2730:"#0 ..\path\lib\Zend\Db\Adapter\Pdo\Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 ..\path\lib\Varien\Db\Adapter\Pdo\Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 ..\path\lib\Zend\Db\Adapter\Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 ..\path\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 ..\path\lib\Varien\Db\Adapter\Pdo\Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 ..\path\app\code\core\Mage\Core\Model\Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 ..\path\app\code\core\Mage\Core\Model\Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 ..\path\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#8 ..\path\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9 ..\path\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10 ..\path\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(360): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11 ..\path\app\code\core\Mage\Core\Model\Resource\Db\Collection\Abstract.php(134): Mage_Core_Model_Resource_Db_Abstract->getReadConnection()
#12 ..\path\app\code\core\Mage\Core\Model\Config.php(1354): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website))
#13 ..\path\app\code\core\Mage\Core\Model\Config.php(1386): Mage_Core_Model_Config->getModelInstance('core_resource/w...', Object(Mage_Core_Model_Resource_Website))
#14 ..\path\app\Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#15 ..\path\app\code\core\Mage\Core\Model\Abstract.php(208): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#16 ..\path\app\code\core\Mage\Core\Model\Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()
#17 ..\path\app\code\core\Mage\Core\Model\App.php(608): Mage_Core_Model_Abstract->getCollection()
#18 ..\path\app\code\core\Mage\Core\Model\App.php(466): Mage_Core_Model_App->_initStores()
#19 ..\path\app\code\core\Mage\Core\Model\App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
#20 ..\path\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#21 ..\path\index.php(87): Mage::run('', 'store')
#22 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";}

Can you try to help me to understand why this happens, and what is the best configuration for Mysql?

Best Answer

check your MySQL settings in my.cnf file, for beging try to increase the max_connections value. Before start to increasing max_connections check do you have enough resources to do that.

Last I highly recommend you to migrate to Linux based hosting for the Magento system.

Related Topic