Home > Net >  PostgreSQL - start a server but the port is taken
PostgreSQL - start a server but the port is taken

Time:09-17

I'm on Windows and with PostgreSQL 14, I tried to make a new PostgreSQL database cluster with initdb --locale=en_US.utf8 PGDATA

Then I created a new PostgreSQL database with createdb my_database

Then I launched the server with pg_ctl -D PGDATA -l serverlog start

But then I get those errors:

2022-09-16 14:27:22.668 CEST [18596] LOG: starting PostgreSQL 14.5, compiled by Visual C build 1914, 64-bit

2022-09-16 14:27:22.676 CEST [18596] LOG: could not bind IPv6 address "::1": Permission denied

2022-09-16 14:27:22.676 CEST [18596] LOG: could not bind IPv4 address "127.0.0.1": Permission denied

2022-09-16 14:27:22.676 CEST [18596] WARNING: could not create listen socket for "localhost" 2022-09-16 14:27:22.676 CEST [18596] FATAL: could not create any TCP/IP sockets

2022-09-16 14:27:22.678 CEST [18596] LOG: database system is shut down

I have been told that my PORT are already used (which mean some of my applications?), so I close useless app that was starting when my computer started like "CCXProcess.exe" which related to Adobe.

I opened pgAdmin4 to look for the port used by the database there (I've just began PostgreSQL, so I only made a database in "Servers" cluster and two others empty clusters) which is 5432 (port by default)?

I then I opened a Ternimal and did netstat -na | find "5432" to look at the port 5432

C:\WINDOWS\system32>
TCP 0.0.0.0:5432 0.0.0.0:0 LISTENING

TCP [::]:5432 [::]:0 LISTENING

And killed it with taskkill /pid 5432 /f but I got this message "5432" not founded.

I don't understand everything, so I'm probably not doing the right step. Any advice please?

CodePudding user response:

It looks like you are trying to kill the process with PID 5432, but 5432 is the port you were investigating right ?

The PID should be at the far right of the output of netstat I think

Rather try:

netstat -aon | findstr 5432

which should output something like

TCP    [::]:5432[::]:0                 LISTENING       18996

And do taskkill /pid 18996 /f with the correct number instead of 18996

  • Related