Thread: Initializing Database Cluster Failed

Initializing Database Cluster Failed

From
Bruce Salgado
Date:
Hi,

I am having issues when doing the installation and also when trying to run psql.

At first, I was able to successfully download postgresql and there were no issues, but I eventually uninstalled the program for unrelated reasons. When I eventually tried to reinstall postgresql, I received the following error message: "Problem running post-install step. Installation may not complete correctly. The database cluster initialization failed."

I looked at the install log and saw the following message:
Executing batch file 'radCD80A.bat'...
    initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/13/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.

Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb

Script stderr:
 Program ended with an error exit code

Error running C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\13/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\Arnav\AppData\Local\Temp/postgresql_installer_4136b1fe11" "C:\Program Files\PostgreSQL\13" "C:\Program Files\PostgreSQL\13\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"

When I try running the command "psql" in command prompt, I get the following message: 
error: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?

When I try typing in "postgres" in command prompt, I get the following message:
FATAL:  XX000: postgres: could not locate matching postgres executable
LOCATION:  getInstallationPaths, d:\pginstaller_13.auto\postgres.windows-x64\src\backend\postmaster\postmaster.c:1489

When I ry running initdb -D "C:\Program Files\PostgreSQL\13\Data, I again get the same error message: 
initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/13/bin/initdb"
but was not the same version as initdb.
Check your installation.

I have used the builtin installer and have tried removing the environment variable from PATH and removing any values in the Windows Registry which have the term "postgres" using Regedit, but I have the same errors regardless.

In addition, when running the installation, I get the following errors.
Error stopping service postgresql-x64-13
Error deleting service postgresql-x64-13 


I am running windows 10 Pro and the OS Build is 19042.1110 
Processor is Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz   1.80 GHz
This was postgresql version 13.3

Thanks,
Bruce