0
votes

Not possible to connect to PostgreSQL 11.

Event though the server is running. I even installed pgAdmin 4, accessed the server, it is working perfectly. But when I do it from the Rails server it shows:

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

I tried every possible thing here in Stackoverflow. Two days straight, and nothing. The same thing with PostgreSQL 10. Log files checked, the file .s.PGSQL.5432 does not appear in the /var/run/postgresql folder.

I am using bash Ubuntu 18.04.2 subsystem on Windows. I checked for permissions already.

1

1 Answers

1
votes

You should check the setting of unix_socket_directories on your PostgreSQL server. It probably does not contain /var/run/postgresql.

Here is what to do:

  • Find a directory in unix_socket_directories.

  • Make sure that the client has access to the directory and the socket file in it.

  • Use the name of the directory as host parameter for your database connection.