psql: could not connect to server: Permission denied

psql: could not connect to server: Permission denied
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

This is due to PostgreSQL service unable to create .s.PGSQL.5432 file in /tmp because of insufficient permission.

You can also follow other topic:
Temporary Solution:

# chmod -R 777 /tmp/

Once done psql command will start work, but after reboot it will stop working.

# su - postgres
$ psql
psql (11.4)
Type "help" for help.

postgres=#

Permanent Solution:

# find / -name postgresql.conf
# vi /usr/local/pgsql/data/postgresql.conf

Change permission for below parameter

unix_socket_permissions = 0777

or comment below parameter in postgresql.conf

# unix_socket_permissions = 0

# service postgres stop
# service postgres start

Check if working or not

# su - postgres
$ psql
psql (11.4)
Type "help" for help.

postgres=#


You can also follow other topic:

Comments

Popular posts from this blog

How to install glibc 2.14 on RHEL 6/ RHEL 7/ CentOS 7

Export and Import users/groups and OU in AD Server 2008 using LDIFDE command.

How to Set Up and Configure latest yum repository on CentOS