When I started PostgreSQL server with specific database cluster on Ubuntu 14.04, the client coundn’t connect to the server.
# start server
postgres@ubuntu:~$ pg_ctl -D /usr/local/pgsql/data -l logfile start
# connect to the server
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"?
After I changed ‘unix_socket_directories’ in the postgresql.conf, it worked.
#unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
unix_socket_directories = '/tmp' # comma-separated list of directories