I am using pgAdmin4
and developing a node.js
app.
I had an abrupt shutdown of the computer and I can no longer connect to the postgresql
server.
The error I get when trying to connect is :
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 5432?
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 5432?
I tried to run postgres -D /usr/local/var/postgres/
as suggested in this SO answer.
However it gave me the following error :
postgres: could not access directory "usr/loval/var/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
So I just manually deleted the postmaster.pid
file inside the PostgreSQL/.../data
folder.
But I still cannot connect to the database server.
I have checked the postgresql.conf
file, and
the listen addresses is already set as listen_addresses = '*'
, and the port is set to 5432
.
I also tried deleting the pgAdmin file in the AppData/Roaming folder.
But it gave me an error:
The application server could not be contacted
and then afterwards the same problem of not being able to connect to the server happens.
Funny enough, it was a matter of just deleting the pdAdmin file in AppData/Roaming folder, and then restarting the computer and restarting the pgAdmin4. That solved it for me.