I found some other Stack Overflow threads on this, but, after trying a lot of solutions, couldn't fix the problem.
Upon running the command psql -U postgres, I got the following error message.
psql: error: could not connect to server: 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.5433"
Running the command pg_lsclusters gave me this output:
12 main 5433 down <unknown> /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
Any thoughts?
If everything has been correctly installed and setup the following command should work:
sudo pg_ctlcluster 12 main start
Related
After experiencing issues related to the existence of two different PostgreSQL versions installed on the same machine, I decided to remove --purge postgresql* and reinstall postgresql-13. Now the output of psql --version is psql (PostgreSQL) 13.4 (Ubuntu 13.4-1).
However, trying to enter psql, I have this error:
psql: error: could not connect to server: Aucun fichier ou dossier de ce type
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I tried the several solutions proposed on similar posts but none solved my issue.
Edit : output of pg_lsclusters is
Ver Cluster Port Status Owner Data directory Log file
12 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
13 main 5433 online postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
I install pgadmin4 using the following command sudo install pgadmin4 and then I installed postgresql using sudo install postgresql . In my terminal I ran the command psql -U postgres -h localhost
It shows connection refuse
Then I go to pgadmin4 and created a server and I wanted to connect to the server it shows
pgadmin connection refuse
Then I wrote host all all all md5 in pg_hba.conf file and I wrote listen_addresses = '*' to postgresql.conf file. and I wrote the following command sudo service postgresql restart but again It shows connection refuse message.
I wrote psql and it shows connections on Unix domain socket
Can you please help me in this regard? What I have missed?
I am using Ubuntu on WSL.
I have been trying to get a postresql server to start but I can't.
When I try to start a service using
service postgresql start, it gives me
11/main (port 5432): down
On top of that even running the psql command gives me :
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"?
Can anyone help me with this? I've looked at a dozen SO questions and it ultimately ends at the same error.
Try out:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
I have installed osm2pgsql and postgresql (9.1) with homebrew, and I have confirmed that /usr/local/bin/osm2pgsql and /usr/local/bin/psql are the versions being used by my system (with which psql, which osm2pgsql).
When I try to run osm2pgsql I get a strange connection error:
osm2pgsql us-south.osm.pbf -r pbf
osm2pgsql SVN version 0.80.0 (32bit id space)
Error: Connection to database failed: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Any suggestions? I can connect locally to my databases fine with Navicat and via psql.
adding "-H localhost" solved the issue for me.
e.g.:
osm2pgsql us-south.osm.pbf -H localhost -r pbf
see here.
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"?
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
try the following
psql template0
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)
You can also get in the CLI via this command:
psql -U postgres -p 5432 -h localhost
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