Postgresql – pgAdmin4 – postgresql application server could not be contacted

pgadminpgadmin-4postgresqlpostgresql-10

I know this question may be marked as repeated, but keep in mind that I have searched for numerous posted solutions and my error has not been fixed.

When starting postgres, I get the following error:

postgresql application server could not be contacted.

When running as administrator the error is "solved", but the application opens in another port – sometimes it opens in 50142, 51120 and others in 50859 -. And when it opens on another port (like the ones previously said), it asks for the password to connect to the server and I get this error:

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?

Infos:

  • Windows 10 64Bits
  • Postgresql 10
  • pgAdmin 4.1
  • Port 5432 (appears even in PostgreSQL\10\data\postgres.conf)

Solutions already tried:

  • Run in administrator mode
  • Modify the postgres.conf file
  • Clear the contents of the folder AppData\Roaming\pgAdmin

I would like to know how to avoid this error when starting the application and always opening on a specific port.

Best Answer

I finally got the right solution after 3 days of tries, this was insane, some answers above was correct at least not in my case but if you running to the same problem I had, I suggested following these steps even though some answers was very clear and helpful regarding deleting the folders inside the pgAdmin folder but not all the time and it depends. So here are the steps to follow:

  1. I installed the PostgreSQL and the pgAdmin4 comes with but the pgAdmin4 wasn't working and it was giving me the error (couldn't connect to the server).
  2. To fix the problem, go to
    This PC > local Disk(C:) > Users > (your folder's name)
  3. in this folder you need to show the hidden folders. on top left click on view > options > change folder and search option > view > (mark show hidden files, folders and drives > then click ok.
  4. now you will see the AppData folder click on it then roaming > pgadmin > (here you will see folders and files) delete them all and then go to the recycle ben and delete them from there too.
  5. now go to pgadmin4 website and download the latest version, follow the steps to finish it .
  6. now go to windows symbol in the bottom left of the screen where is says start, and run the latest version of the pgAdmin4 that you just installed, you will see it there separately from the one that, it comes inside the PostgreSQL. (RUN THE NEW VERSION YOU JUST INSTALLED, IT WILL WORK, DO NOT RUN THE VERSION THAT IT COMES WITH POSTGRESQL BECAUSE IT WON'T WORK)
Related Topic