To import a PostgreSQL database using the psql - shell

I'm getting an error after making changes in the postgresql.conf
psql: could not connect to server: Connection refused
Is the server running on host "IP" and accepting
TCP/IP connections on port 5432?
Can someone help me around this?

Related

Vagrant Homestead is not connecting with PostgresSql

While connecting psql in Vagrant Homestead I am getting the following error:
psql: error: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and
accepting TCP/IP connections on port 5432?
Can anyone please share some pointers on where to look for errors?
Connection refused means that the port you are trying to connect to is not actually open.
Just have re-read on documents https://laravel.com/docs/6.x/homestead#ports
so I think to try 54320 port in your local machin.

Change Postgres defaut port in windows 10 console for psql command

When I install Postgres I make a mistake - change default port from 5432 to 5434 and after all, I change the port back through postgresql.conf. All app connections work fine with new 5432 port value, but cmd interface unavailable:
psql
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5434?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5434?
I try to reinstall Postgres from scratch but without a result. How to change the port for windows cmd?
Clear the PGPORT environment variable, which must be set to 5434.
Then psql will use the default port 5432.

postgres: client could not connect to server

For clarification, please note that I have found several similar questions on stackoverflow, but I could not fix my issue.
psql: could not connect to server: Connection refused” Error when connecting to remote database
psql: How to Allow Remote Access to PostgreSQL database
I am trying to connect to a postgres DB installed in a remote server.
To create a connection from the client I am using QGIS plugin (Add PostGIS Layer):
The error that occurs is:
could not connect to server: Connection refused (0x0000274D/10061) is the server running on host "localhost" (::1) and accepting TCP/IP connection on port 5432
Additionally I added the host's IP Adress in the Host field, but then another error message occurs:
could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "hosts_ip_adress" and accepting TCP/IP connections on port 5432?
My settings are:
Postgres installed version is 10.0 with PostGIS extension
Host operating System: Windows 7
Client operating System: Windows 7
I edited pg_hba.conf to:
host all all 0.0.0.0/0 md5
and changes listen parameter in 'postgresql.conf' to:
listen_addresses = '*'
both files are located in C:\Program Files\PostgreSQL\10\data
restartet pgAdmin4
My devices are in the same network. Each one is connected via LAN cable.
I suppose that a firewall is preventing the connection?

can't connect to postgres on windows10

I am setting up project on my windows PC and I have a problem with postgres.
Project is set on docker.
when I run docker-compose up I receive error
: *** Failed to connect to database dev; trying to create database
/usr/local/bundle/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:224:in `initialize': PG::ConnectionBad: could not connect to server: Connection refused (Sequel::DatabaseConnectionError)
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
I don't know what to do. I have already installed microsoft easy-fix for TCP-IP, shut down windows firewall, changed all connection in pg_hba.conf to trust. Nothing helps. I don't have any antivirus software installed.
nmap report:
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0027s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 995 closed ports
PORT STATE SERVICE
135/tcp open msrpc
445/tcp open microsoft-ds
2068/tcp open avocentkvm
2179/tcp open vmrdp
5432/tcp open postgresql
edit:
I run psql -h localhost and received
psql: CATASTROPHIC: role "Kamil" does not exist
Kamil is my PC name.
edit2:
is it possible that docker doesn't have access to postgres on localhost?
problem solved
I had to set environment var to DB_HOST=docker.for.win.localhost

** (Mix) The database for PhoenixHerokuWsmoak.Repo couldn't be created, reason given: psql: could not connect to server

** (Mix) The database for PhoenixHerokuWsmoak.Repo couldn't be created, reason given: psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
If you have this problem, Well, that's because Postgres isn't running locally. I'm not even sure it's installed. The easiest way to do that on a Mac is to grab Postgres.app from http://postgresapp.com and copy it to the /Applications folder.
Trying again:
$ mix​​ ​​ecto.create​

Resources