Reputation: 928
I am trying to install postgresql on ubuntu. I followed the steps from http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804/.
And on typing the command :
psql template1
I am getting the following 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"?
Upvotes: 3
Views: 3769
Reputation: 161
This should solve the error,
make a symbolic link to the /tmp/.s.PGSQL.5432:
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
Thanks to this post
Upvotes: 0
Reputation: 2817
The problem for me was that I had previously installed version 9.1, and 9.1 was still hogging the default port 5432. I was able to find this with the command:
root@labs:/home/caleb# /etc/init.d/postgresql status
9.1/main (port 5432): down
9.2/main (port 5433): online
So I was able to see that my 9.2 database was running on port 5433. So to connect, I had to explicitly specify port 5433:
psql -p 5433
Upvotes: 1
Reputation: 12447
You can also get in the CLI via this command:
psql -U postgres -p 5432 -h localhost
Upvotes: 0
Reputation: 9385
what resolved this error for me was deleting a file called postmaster.pid in the postgres directory. please see my question/answer using the following link for step by step instructions. my issue was not related to file permissions:
psql: could not connect to server: No such file or directory (Mac OS X)
Upvotes: 0