When I run static content deploy on my local Magento2 instance I get this error message:

  SQLSTATE[HY000] [2002] No such file or directory

Is this a etc/hosts and/or virtual hosts issue?

1 Answer 1


This is a combination of issues. This article outlines the problem you are having:


And this goes over how to fix it:


While there are a few different ways to fix this, i have linked to the one solution that i have used.


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.