I've just installed the postgresql 9.1 on one brand new Ubuntu 12.04 LTS server with the following command : sudo apt-get install postgresql libpq-dev The installation proceeded without errors. Basically I should be able to connect to local server, however when I tap the command psql, the following errors appears :
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"?
I've searched a lot of posts online, but cannot solve problem (very often, the mentioned directory doesn't exist on my server). Can anyone suggests some solutions ? Thanks !
“Could not connect to server: Connection refused” To be sure that PostgreSQL is running, you can also restart it with systemctl restart postgresql. If this does not fix the problem, the most likely cause of this error is that PostgreSQL is not configured to allow TCP/IP connections.
If the connection is still failing, then there might be a permission issue in the pg_hba. conf access configuration file. Make sure this is set up correctly to accept connections from your IP. Finally, ensure there are no firewalls or iptables on the Postgres server that are blocking connections.
Postgres itself is a database “server.” There are several ways to connect to Postgres via “clients,” including GUIs, CLIs, and programming languages often via ORMs. In order to run and use Postgres on your own computer, you will need to set up both a Postgres server and a client.
It seems that you did not install postgresql successfully. Please follow here:
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get -y update
sudo apt-get purge postgresql* # ending * is important
sudo apt-get install postgresql libpq-dev
It will fix your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With