I have installed postgresql 14 on a Windows 10 machine. But, I'm getting this message:
C:\Program Files\PostgreSQL\14\bin
> pg_ctl.exe start -D "C:\postgres"
pg_ctl: directory "C:/postgres" is not a database cluster directory
The installation log file at %temp%\install-postgresql.log
shows this text at the very end:
Error running C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\nephewtom\AppData\Local\Temp/postgresql_installer_80ce3934c2" "C:\Program Files\PostgreSQL\14" "C:\Program Files\PostgreSQL\14\data" 5432 "DEFAULT" 0: Program ended with an error exit code Problem running post-install step. Installation may not complete correctly The database cluster initialisation failed. Setting variable whoami from C:\WINDOWS\System32\whoami Script exit code: 0
I suspect it may be due to a permissions issue.
Checking the troubleshoot guide here, it suggests to use cscript.exe
, but that failed.
initdb
, run it manually. You may also want to runpg_ctl register
with the appropriate options to create a Windows service..\pg_ctl.exe register -D c:\PostgreSQL\14\data -N postgresql -U nephewtom -P nephewtom -S auto -e postgresql
pg_ctl: could not register service "postgresql": error code 1057