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.
1 Answer 1
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.
- 
 fixed by executing above command but didn't identify why did it occurred?zuber bandi– zuber bandi2021年07月08日 12:57:30 +00:00Commented 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.Bilal Usean– Bilal Usean2021年07月08日 13:10:35 +00:00Commented Jul 8, 2021 at 13:10