2

Issue
I have installed postgresql 14 on Windows 11, as per these instructions. I configured it so the database server running on the background runs on port 5432. Using psql and pgAdmin, I am able to connect to that server, and I can see it running in TaskManager -> Services.

As such, I would expect running pg_ctl status to return confirmation of that, but all I am getting is "no server running", even when I explicitly specify the data directory with the -D option.

Things I've tried checking
I have checked the data directory by running select setting from pg_settings where name = 'data_directory';
The result of that is: C:/Program Files/PostgreSQL/14/data

also running running echo echo $PGDATA in my Git Bash terminal returns C:\Program Files\PostgreSQL\14\data

As such, the default argument for -D of pg_ctl status is that directory if my understanding is correct, but also specifying the path explicitly returns the same result: pg_ctl status -D "$PGDATA"

I have found the same issue on a few other questions such as this one, but none of the answers fit my case. If anyone knows, or can see where I'm misunderstanding something from my explanation, please tell me.

user3801230
  • 143
  • 1
  • 8

1 Answers1

0

Open a Windows CMD shell in Administrator mode, then type:

cd c:\program files\postgres\12\bin

pg_ctl status -D "c:\program files\postgresql\12\data"

You should see:

pg_ctl: server is running (PID: 5684)