etsauer
etsauer

Reputation: 367

Postgresql (pgsql) client expecting sockets in different location from postgrsql-server

While trying to connect to postgres running locally on my workstation, I get:

$ sudo -u postgres psql -c "create role ..."
could not change directory to "/home/esauer/workspace/cfme"
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"?

My postgres-server install creates sockets in /var/run/postgresql.

How do I get the client to look in the proper location?

Upvotes: 5

Views: 19398

Answers (1)

Fabrizio Mazzoni
Fabrizio Mazzoni

Reputation: 1909

Check the --host option with psql --help.

Then you can make it permanent by setting it in your .psqlrc user file.

In your case try:

psql -h /var/run/postgresql -d your_database

Upvotes: 9

Related Questions