Q: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? When I want to open pgAdmin 4, this message appears:
could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

I have changed the posgresql.conf file in the following way:
listen_addresses = '*'
port = 5432

However, the message keeps appearing. What should I do?

A: I was encountering this issue and I think I've found an answer. When I was encountering this, my database environment setup included whitespace between the declarations.
Look at the spaces next tot he "=" in this image
The fix for it, was eliminating the whitespace. So in this image the whitespace is removed. Try looking through your .yml file and see if there is any unnecessary whitespace and that might be your problem.

A: Django settings.py -> Database={host:db} . Other database option remain same. Like
DATABASE_ENGINE=django.db.backends.postgresql
DATABASE_USER=postgres
DATABASE_PASSWORD=1234
DATABASE_NAME=pos
DATABASE_HOST=db
DATABASE_PORT=5432


A: I just tried to change the properties of PostgreSQL and revised the port to 5433 instead of 5432. Hope it works for you, too!






