2

I'm getting the following error on a new blank Magento 2 installation:

a:4:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:7106:"#0 /home/signboxc/public_html_devshop/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/signboxc/public_html_devshop/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(340): Zend_Db_Adapter_Pdo_Mysql->_connect()

I'm running PHP 5.6 compiled with the PDO extension and the MySQL credentials in app/etc/env.php are definitely correct.

I can link the full error from the reports if necessary.

I also can't seem to find additional suggestions as to why this might be happening at the moment. Any insight is appreciated. Thanks.

asked Jul 29, 2016 at 23:02

1 Answer 1

0

I got this error before five minutes :-)

a:4:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:5710:"#0 /var/www/public/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /var/www/public/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(332): Zend_Db_Adapter_Pdo_Mysql->_connect()

I fixed this error by restart apache and mysql

$ service apache2 restart
$ service mysql restart

note: above command is for ubuntu so alter the above command as per your operating system.

answered Jul 30, 2016 at 6:00
2
  • fixed by executing above command but didn't identify why did it occurred? Commented Jul 8, 2021 at 12:57
  • The above error will come in mostly two cases, 1. Forgot to restart the apache server after installed the ext-pdo_mysql, 2. Mysql server down. Commented Jul 8, 2021 at 13:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.