Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maqadeersaeed/1f69d15cbd06c123c2b397384f261358 to your computer and use it in GitHub Desktop.

Select an option

Save maqadeersaeed/1f69d15cbd06c123c2b397384f261358 to your computer and use it in GitHub Desktop.
It was problem running post-install step postgresql. Due to User Privileges Issue, Sysm was unable to create data folder and initilize database.
Steps
1. Ensure Permissions:
Right-click the PostgreSQL installer and select Run as Administrator to ensure it has full privileges.
2. Clean Existing Data Directory:
Delete the data directory created during installation (C:\installs\PostgreSQL\17\data), as it may contain incomplete initialization files from the failed attempt.
3. Create a New Data Directory with Initdb Command - Open Command Prompt as Administrator and run:
C:\installs\PostgreSQL\17\bin\initdb.exe -D C:\installs\PostgreSQL\17\data
4. Register the PostgreSQL Service Manually: In the same Command Prompt, run;
C:\installs\PostgreSQL\17\bin\pg_ctl.exe register -N "postgresql-x64-17" -D "C:\installs\PostgreSQL\17\data" -U "NT AUTHORITY\NetworkService"
5. Start the PostgreSQL Service:
net start postgresql-x64-17
Or, go to Services (Windows + R, type services.msc), find postgresql-x64-17, and start it manually.
Verify the postgresql.conf File:
6. Confirm that C:/installs/PostgreSQL/17/data/postgresql.conf exists and has the correct configuration. If missing, reinitialize the data directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment