篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了psql: error: connection to server on socket “/tmp/.s.PGSQL.5432“ failed: No such file or directory相关的知识,希望对你有一定的参考价值。
brew info postgres
/usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres
FATAL: lock file "postmaster.pid" already exists(本条为报错信息不是执行命令)
cd /usr/local/var/postgres
rm/usr/local/var/postgres/postmaster.pid
brew services restart postgresql
完事!!!
“psql: could not connect to server: Connection refused” Error when connecting to remote database(示例代
问题:
I am trying to connect to a postgres database installed in a remote server using the following command:
psql -h host_ip -U db_username -d db_name
This the error that occurs:
psql: could not connect to server: Connection refused Is the server running on host "" and accepting TCP/IP connections on port 5432?
Postgres installed version is 9.4.
Host operating system : Ubuntu 15.04
Client operating system : Centos 7
I already tried the following but the issue remains unresolved:
Edited pg_hba.conf file to include
host all all 0.0.0.0/0 md5
Edited ‘postgresql.conf‘ and changed the listen parameter to
listen_addresses=‘*‘
Restarted postgres service.
Disabled firewall and iptables on host and client.
I checked by running the psql command locally and it worked.
I tried the second solution given in this question. Running nmap gave me the following output:
Starting Nmap 6.47 ( http://nmap.org ) at 2015-09-07 18:08 IST Nmap scan report for 10.17.250.250 Host is up (0.0000040s latency). Not shown: 997 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http
sudo ufw disable
, but I‘m still getting the same error. – Poonam Anthony Sep 8 ‘15 at 10:25