10

This page just started coming up:

There has been an error processing your request

a:4:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:2075:"#0 /home/dtacolle/public_html/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/dtacolle/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(313): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/dtacolle/public_html/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/dtacolle/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/dtacolle/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#8 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Resource/Config.php(55): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Config.php(354): Mage_Core_Model_Resource_Config->loadToXml(Object(Mage_Core_Model_Config))
#12 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/Config.php(260): Mage_Core_Model_Config->loadDb()
#13 /home/dtacolle/public_html/app/code/core/Mage/Core/Model/App.php(270): Mage_Core_Model_Config->init(Array)
#14 /home/dtacolle/public_html/app/Mage.php(640): Mage_Core_Model_App->init('dtacollectibles...', 'website', Array)
#15 /home/dtacolle/public_html/get.php(113): Mage::init('dtacollectibles...', 'website')
#16 {main}";s:3:"url";s:91:"/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/c/o/con-dc-0007_2.jpg";s:11:"script_name";s:8:"/get.php";}

2 Answers 2

17

Take a look at PDOException SQLSTATE[HY000] [2002] No such file or directory

Check your "host" setting in

Magento 1: /app/etc/local.xml
Magento 2: /app/etc/env.php

Try changing it from "localhost" to "127.0.0.1"

4
  • Restarted the server and the site is back up now. Thanks
    – Hector
    Commented Nov 13, 2014 at 14:53
  • does anyone know what this is for magento 2? not seeing /app/etc/local.xml Commented Oct 15, 2019 at 1:14
  • 2
    @RobertSinclair... see app/etc/env.php Commented Oct 15, 2019 at 1:37
  • I resolved this on my local with ... sudo service mysql start Commented Feb 3, 2020 at 22:02
1

Based on Renon's answer above but for For Magento 2 (since there was no /app/etc/local.xml)

You can change localhost to 127.0.0.1

app/etc/env.php

Btw if you're getting this error while executing commands like "static content deploy" then another fix for this would be to simply execute your command using another PHP version (meaning: if you got Magento up and running but this command fails it could be a disconnect between the PHP version used by the command line vs PHP version used by your server)

So in my case, simply executing the command like the following worked:

/Applications/MAMP/bin/php/php7.1.8/bin/php bin/magento setup:static-content:deploy -f**

^ replace /Applications/MAMP/bin/php/php7.1.8/bin/php with your PHP executable

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.