The MySQL is regularly going away for Magento 2 only. While working, if I refresh cache, then it shows gone.

I can login to the MySQL and do all the queries. It is working. Also, the local Magento 1 will work properly. Only the Magento 2 has a problem.

 3 exception(s):
    Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2006] MySQL server has gone away
    Exception #1 (PDOException): SQLSTATE[HY000] [2006] MySQL server has gone away
    Exception #2 (Exception): Warning: PDO::__construct(): MySQL server has gone away in /Library/WebServer/Documents/magento/store2/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php on line 129

    Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2006] MySQL server has gone away
    #0 /Library/WebServer/Documents/magento/store2/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
    #1 /Library/WebServer/Documents/magento/store2/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(340): Zend_Db_Adapter_Pdo_Mysql->_connect()
    #2 /Library/WebServer/Documents/magento/store2/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect()
    #3 /Library/WebServer/Documents/magento/store2/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SHOW TABLES', Array)
  • Please check your Mysql connection again with user name and pwd. Aug 4, 2016 at 10:35
  • I have checked mysql connection. When, i get the error in the magento2 website, i can open in another tab magento1 website connected to separate database in localhost. Able to login to mysql command line with the magento2 database, and execute queries. i am using macbook for local development with magento1 and magento2 instances. Migrating modules from magento1 to magento2. Aug 4, 2016 at 11:35
  • You can try these suggestions. Aug 5, 2016 at 19:19
  • Tried it, but of no luck. Still getting the error, regularly. Aug 9, 2016 at 6:16
  • i have uninstalled mysql and installed mariadb. Now it is working properly, and has not given the error till now. Aug 12, 2016 at 5:10

1 Answer 1


After removing the mysql and installing mariadb, the problem has gone. I think, there was some problem in my mysql. Didn't try re-installing mysql.

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.