I understand that this is a french blog but I this is the only place where I get answers so posting my question here:
I just started using PostgreSQL 9.5 and facing some problem with starting the DB service on RHEL6. I get the following error while trying to start the PostgreSQL service:
could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
I am not allowed to change any permissions under /var folder, so I wanted the lock file to be created under the /tmp directory instead. So I changed my Dbstart script and in postgresql.conf file, I changed:
#unix_socket_directories = '/var/run/postgresql, /tmp'
unix_socket_directories = '/tmp'
after initdb. Now the PostgreSQL service starts without any error however when i try to connect to the DB and create a DB or run any query, it gives me an error: 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"?
I thought I already changed the unix_socket_directories to /tmp but it is still trying to create a lock file under /var/run/postgres .
Can someone please suggest how to create the socket and the PG locks under /tmp dir and not /var/run ?
You can also consider sending question on pgsql-general mailing list (https://www.postgresql.org/list/).
Anyway, your problem is that you tell your server where to put the socket file, but you don't tell your client it was moved. So without any further instruction, it just fallbacks to default location in /var.
You can run "psql -h /tmp", or put in your .bashrc file or similar a