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.
Related
I've installed posgresql:
nix-env -iA nixos.postgresql
Now I wanto use it.
psql
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Must I add something in /etc/nixos/configuration.nix ?
update
I've tried to do like this link. i.e. install in nix-shell and not in nix-env.
I've the same shell.nix
nix-shell --pure shell.nix
done
server started
psql
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 "/mnt/c/Users/Pierre-Olivier/nix/psql/.pg/.s.PGSQL.5432"?
psql is the PostgreSQL interactive terminal.
What you are trying to do is connect to database without PostgreSQL running in first place.
Follow these steps:
Initialize the database with initdb -D .data
Start a PostgreSQL server with pg_ctl -D .data -l logfile start
Make sure it's running pg_ctl -D .data status
Connect to database with psql -d postgres (by default, postgres database is created)
At the end, make sure to stop database with pg_ctl -D .data stop when leaving the nix shell.
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'm trying to dump a postgres db from a remote client:
pg_dump -Z7 -Fc -h xx.xx.xx.xx -U user dbname > /path/dump/dump.bck
This is the error I received:
pg_dump: server version: 9.4.21; pg_dump version: 9.3.24
pg_dump: aborting because of server version mismatch
The error itself is pretty clear, but unfortunately the remote client where I execute the command is a really old physical file server (ubuntu 14.04) that is impossibile to upgrade.
I have tried to add the postgresql repository in order to install a newer version of pg_dump but the actual os version is not supported anymore.
Is there a way to overcome this problem?
There is no way to overcome the problem except by using a more recent client version. Some options:
install PostgreSQL from source (easier than you think, unless it is Windows)
use a different client machine, e.g. the database server itself
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
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