0

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?

8
  • Please elaborate on what you've tried so far to solve your problem. Aug 5, 2016 at 13:13
  • At the moment i did not try anything, i thing i have to do some specific configuration in my ini file "my.ini", you think so?
    – Ivan
    Aug 5, 2016 at 13:18
  • Well, it sounds like your DB is really busy. Aug 5, 2016 at 13:21
  • yes it is so, can you suggest me some configuration or something to change?
    – Ivan
    Aug 5, 2016 at 13:24
  • when you say "on a windows machine", do you mean a server or locally on your computer? Aug 5, 2016 at 14:21

1 Answer 1

2

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.

3
  • Thank you for suggesting to migrate to Linux i will take it for sure into consideration. For now which value do you think is enought for max_connections? now i have max_connections=450 and memory (RAM) is allocated for 2 GB (i have 4 GB)
    – Ivan
    Aug 5, 2016 at 15:37
  • mysql -e 'SHOW STATUS WHERE variable_name LIKE "Threads_%" OR variable_name = "Connections"' -u user -p ----> this will show table check for Threads_connected, to see how many connection you have. Also check slow log query log dev.mysql.com/doc/refman/5.7/en/slow-query-log.html there is a lot of articles that can be useful, google will help you for that. If you using mysql greater than 5.6 you can connect to it with MySql workbench there is section Performance, that will help you to watch the MySql in real time.
    – Nikola
    Aug 5, 2016 at 18:34
  • Thank you for the suggestion, can i use that command in a wondows machine?
    – Ivan
    Aug 6, 2016 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.