Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

psql not using right config file

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

OS: macOS Monterey

postgres version: 9.6

>Solution :

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

psql -h /socket/directory
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading