Search code examples
phppostgresqlmacosadminer

Adminer: Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


This is the full error message:

Unable to connect to PostgreSQL server: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

I get it when I open local Adminer URL after upgrading to OS X Mojave. I read a lot of answers here on SO and in other sites most of them say to check if Postgresql is running but in my case it is running. Or to create directories and change permissions but I don't think this is the issue. After all I've my own application running on the same environment and it's accessing Postgresql data. I'm running Postgresql 9.6.


Solution

  • After trying a lot of things I got inspired by a post talking about localhost. As I said in the question my own application was able to connect to Postgresql and collect data. At the end the solution is incredibly simple: In the login form of Adminer you just need to fill the Server field with localhost (Pay attention! Usually you can already read "localhost" in that field but it's a suggestion not a real value, you actually need to type "localhost" inside.), in case you can also add the port, i.e. "localhost:5432". The same should be valid if you get this error message in a generic PHP script.