Home > Net >  psql not using right config file
psql not using right config file

Time:04-28

When I attempt to start a psql server by running 'psql' in command line, I receive this error:

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"?

For some reason postgres was unable to access /tmp so I edited my postgresql.conf file and assigned unix_socket_directories to another folder. This worked and allowed me to start a server on 5432 and I can now see a .s.PGSQL.5432.lock in the newly created folder. BUT, psql seems to still be looking for the lock file inside the tmp folder. So I guess my question is: How can I tell psql to look inside my newly created folder instead of /tmp?

I have run a bunch of mdfind commands looking for other postgresql.conf files but the only one I could find was in /Library/Application\ Support/Postgress/var-9.6 and that is the config file I have already edited.

I have installed postgress from Postgres.app and NOT using brew.

OS: macOS Monterey

postgres version: 9.6

CodePudding user response:

You can use the socket directory (absolute path!) with the -h option of psql:

psql -h /socket/directory
  • Related