Your port 5432 may be occupied by another program. To guarantee that this is not the case, we check by executing in cmd
(console) of the following command:
netstat -an | find ":5432"
If the console returns information, it means that the port if it is busy, if it does not return anything, means that it is available for use by any program.
I would recommend (if possible) delete any version of
postgresql that you have installed in view that there is no guarantee that the
installation of pgadmin 4 was successful and may be
hindering the correct execution of pgadmin 3 and therefore you get
the error that talks about the port rejecting the connection.
There are many tools to remove programs "completely" like Revo Uninstaller or Ccleaner . I would recommend using Revo Uninstaller to remove the postgresql versions and then run the Ccleaner registry cleaner as many times as necessary until there are no incidents in the analyzer.
Observation: If you want to have only one program, you could use Ccleaner both to uninstall the programs and to clean the registry.
Restart the computer and pass the Ccleaner registry cleaner again as many times as necessary.
Then to eliminate the postgresql service you use in your command console with administrator permissions:
net user /delete postgres
To ensure that no "residuals" remain, you check the system services. For this you go to Start - > Run and place inside execute msconfig
.
Once in the system configuration window, you go to the services tab and look for (by pressing the P key repeatedly) any postgresql service. If you still find postgresql you must delete the service.
Then you proceed to install the postgresql version you need again. You must be careful that the installation does not throw any error because even when it can be completed throwing an error is not recommended precisely because there are cases like the one you are presenting at this time.
At the end of the installation go to start - > execute and place services.msc
. When you open the window you search again by pressing the p key until you locate the postgres service. Once you find it double click on it and check what status it is in.
If the service is not running you should try to start it by clicking on the start button. By now, postgresql and therefore pgadmin should work correctly. Without closing this window, set the Automatic option to Start type and select it. With the above you get the service to run automatically when you turn on the computer and automate the task.
Here are some references you can follow for more information:
1) Check busy port
2) Automatically start the service of postgresql
3) Install ccleaner
4) Clean registration with ccleaner
5) Remove service in Windows
I hope it helps. Greetings!