Can't connect to DB while installing Drupal 8. DB is located on localhost acording to direct admin but i can get to DB only when using ip address in advanced options of drupal installation otherwise i get: SQLSTATE[HY000] [2002] No such file or directory. With ip entered it says following message: SQLSTATE[HY000] [1045] Access denied for user on server.......

I have tried different users and db that i have created on server (granted all permissions). No luck.

I have no problem logging to that DB with that user using phpmyadmin. What does it seem to be the problem ?


Instead of localhost, try

  • Worker. Thanks. any ideal why we have to use instead of localhost.... And why it didn't work when i used server ip address? Just curious. Apr 1 '18 at 10:08
  • localhost is an alias of, and sometimes some configurations haven't got that alias registered.
    – Jaypan
    Apr 1 '18 at 10:09
  • 1
    Usually with php/mysql, localhost connects through a socket file, which is AFAIK faster but it looks like that is misconfigured on your system. uses the network stack and is not affected by that misconfiguration. See dev.mysql.com/doc/refman/5.5/en/connecting.html for more information.
    – Berdir
    Apr 1 '18 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.