Monthly Archives: February 2017

Issue connecting to database

Issue connecting to database:

[root@ravikumar]# psql -U postgres -d EMSDB
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”?

Solution:

1. Try to stop the database

bash-4.2$ ./pg_ctl -D /data/ems/db/ -o -p5342 stop -m fast
pg_ctl: directory “/data/ems/db/” is not a database cluster directory

2. If it gives above error,
i) remove postgres pid or lock files under /tmp
ii) check pg_hba.conf file has correct values

3. Excute the command under postgres_home/bin ./pg_ctl -D /data/aniems/db/ -o -p5342 start

4. If the above step does not work, restart the system