Magento – Magento 2 PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections

databasemagento2

When I run a script for upload products more than 5000. after 152 products upload showing
below error. How can I upload thousand of products from csv without error?

Error: PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040]
Too many connections in
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php:128
Stack trace:
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php(128):
PDO->__construct('mysql:host=loca…', 'root', 'password', Array)
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Mysql.php(111):
Zend_Db_Adapter_Pdo_Abstract->_connect()
C:\xampp\htdocs\magento23\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(406):
Zend_Db_Adapter_Pdo_Mysql->_connect()
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(460):
Magento\Framework\DB\Adapter\Pdo\Mysql->_connect()
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php(238):
Zend_Db_Adapter_Abstract->query('SELECT `store_w…', Array)
C:\xampp\htdocs\magento23\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php
in
C:\xampp\htdocs\magento23\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php
on line 144

Best Answer

Go to your mysql configuration file(/etc/my.cnf) and increase max_connections value like

e.x : max_connections = 500
Related Topic