i got a new laptop from Dell(XPS 15), with Windows 10 Pro. I have always the same issue During installation of postgres "Problem running post-install step. Installation may not complete correctly. The Database cluster initialisation failed." .
i tried a lot of solutions of past threads: Install postgres not into progam files create a user named postgres with full access to postgress directory, explained here https://www.youtube.com/watch?v=pS_zWDDDSe0 Checked for new win-updates Turned off Firewall and Antivirus of Windows.
Error running cscript //NoLogo "C:\develop\postgres/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\develop\postgres" "C:\develop\postgres\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. [14:03:49] Delete the temporary scripts directory... Creating menu shortcuts... Executing cscript //NoLogo "C:\develop\postgres\installer\server\createshortcuts_clt.vbs" "PostgreSQL 11" "C:\develop\postgres" Script exit code: 0
EDIT ERROR LOG
Executing batch file 'radAD31B.bat'...
The program "postgres" was found by "C:/develop/postgres/bin/initdb.exe" but was not the same version as initdb.
PostgreSQL is an open-source, object-based relational database management system. It is well-known for its robustness, SQL compliance, and extensibility. In this tutorial, we will go over the step-by-step process of installing PostgreSQL on Windows 10.
I've just struggled with this for several hours, so I'm posting this for anyone else who winds up here.
Initially, all I could find were two bug reports on the pgsql-bugs
mailing list:
BUG #15856: The program "postgres" was found by "initdb" but was not the same version as initdb.
BUG #15970: Db initialization error - initdb.exe and postgres not same version
The specific symptoms are:
The program "postgres" was found by ".../initdb.exe" but was not the same version as initdb.
and although the versions match, you get this:
C:\Program Files\PostgreSQL\11\bin>postgres -V
WARNING: 01000: could not determine encoding for locale
"<some encoding>.utf8": codeset is "CPutf8"
If these are your symptoms, the issue is that you have your region/language settings set to use UTF-8 (beta setting). This causes problems with lots of programs, and PostgreSQL is one of them. Disable this and re-install and you should be fine.
If you ever changed the command line code encoding parameter in the registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun
to chcp 65001, chcp 1251 or any other, then that may be the issue.
Returning the value of the command line encoding registry value to default (empty) solved the problem in my case.
Try to change your registry value to empty:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun
Follow these steps to avoid this error
Just had this issue with postgres 12 my method to solve it is similar to Atif's but uses the command line:
Uninstall PostgreSQL
Delete the postgres user if it still exists :
net user postgres /delete
Create the postgres user with a password you can remember:
net user /add postgres [password]
Add the postgres user to the Administrators group:
net localgroup administrators postgres /add
SKIP this as group no longer exists on win 10 and default users should have necessary permissions - Add the postgres user to the Power Users group
Run a command window as the postgres user: (opens up new command window) :
runas /user:postgres cmd.exe
copy the install file to a location reachable by that user and run it e.g.:
C:\Download\postgresql-12.4-1-windows-x64.exe
Remove the postgres user from the Administrators group:
net localgroup administrators postgres /delete
That's it. Hope this is useful
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With