torsdag den 13. november 2014

Connect to postgresql 9.2 server in openSUSE 13.2

I tried to connect to my postgresql server after upgrading to openSUSE 13.2 from 13.1 using the guide from
That resulted in this error message:

psql: 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"?

There was no files in /var/run/postgresql/. So that explained why it could not connect to that Unix domain socket.
So where was the socket? Reading this answer I found that I could run this command to figure out where the socket was:
~> netstat -nlp | grep 5432
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0  *               LISTEN      12827/postgres     
tcp        0      0 :::5432                 :::*                    LISTEN      12827/postgres     
unix  2      [ ACC ]     STREAM     LISTENING     10994605 12827/postgres      /tmp/.s.PGSQL.543

That indicated that the socket was located at /tmp/ instead of /var/run/postgresql/ I was then able to find an explanation here

With that in mind i tried to connect with /tmp/ as host:
~> psql -h /tmp/
psql (9.3.5, server 9.2.7)
Type "help" for help.

That worked and as you can see the server and the client versions does not match. That could explain why the client was compiled with a different default host. Next thing could be to try to update the server from 9.2 to 9.3.

Ingen kommentarer:

Send en kommentar