Postgresql Error – could not connect to server, Is the server accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”?
Posted by
FatDBA
on August 31, 2018
Hey Mates,
I have got this new test box for some POCs related with Data Migration between Oracle and PostgreSQL, and this is the very first time i tried to connect with psql on this server and got an error. This was a newly provisioned server with Postgresql 8.4 installed.
Error is something related with the connection settings and is pasted below.
[root@fatdba ~]# psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I tried to initialize the server and started the services on the machine and it was started smoothly with no error.
[root@fatdba ~]# service postgresql initdb
Initializing database:
[ OK ]
[root@fatdba ~]# service postgresql start
Starting postgresql service:
I tried to connect with the database once again and this time got a different set of error which is now related with Authentication which was Ident based. But this gave me an idea that something is related with the authentication protocol what’s bothering the database to start and to verify that I’ve checked pg_hba configuration file and changed the method to ‘Trust’ for this host connection type and did a restart of postgres serviced. And that worked!
[root@fatdba data]# psql -U postgres -W
Password for user postgres:
psql: FATAL: Ident authentication failed for user "postgres"
[root@fatdba data]# vi pg_hba.conf
[root@fatdba data]#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.145.129/32 trust
[root@fatdba data]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]
[root@fatdba data]#
This entry was posted on August 31, 2018 at 9:58 PM and is filed under
Basics
.
Tagged:
postgres
. You can follow any responses to this entry through the
RSS 2.0
feed.
You can
leave a response
, or
trackback
from your own site.