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.
Installing PostgreSQL on Windows with the EDB installer is begging to get bald(er) faster. You can run PostgreSQL on WSL (Windows Subsystem for Linux) and connect to it on Windows!
Open Windows Terminal/PowerShell as administrator (right click the start-icon on Windows 11 -> Windows Terminal (administrator). Type:
Reboot your computer. After login Ubuntu will automatically be installing, WSL2 and Ubuntu is standard on Windows 11 (check documentation on how to select a different distro, etc.) Follow the instructions to enter your desired username and password.
sudo apt update && sudo apt upgrade
sudo apt install postgresql
Give the 'postgres' user a password:
sudo passwd postgres
Start the service and open psql shell:
sudo service postgresql start && sudo -u postgres psql
Notice that the password you created is not the DB password for postgres, so unless you create a new user you can give postgres one in the psql shell:
ALTER USER postgres PASSWORD 'mypw';
Now you can install pgAdmin or use your own program (in 'normal' Windows) to confirm that you can connect on 127.0.0.1 with port 5432 (may vary) with the user postgres and his password.
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:
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.
Just had this issue with postgres 12 my method to solve it is similar to Atif's but uses the command line:
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.:
Remove the postgres user from the Administrators group:
net localgroup administrators postgres /delete
That's it. Hope this is useful
Follow these steps to avoid this error
postgresWindows user for their installation.
postgresWindows user since I think Postgres 9.2 or something around that. But then I never use the installer, I use the ZIP packages and run
Uninstallation may not remove all registry entries. You may type
registry in the taskbar search and open
And remove entries pertaining to
I have looked at the available solutions but none worked for me so I simply created a new user on my Windows 10 desktop and did the installation there and it was able to complete successfully.
Same problem. Beta UTF-8 was not selected. However this gave me the idea.
I was trying to install using different locale than the default locale of the system I am using. Tried a couple of times.
Installed successfully using the default locale.
If you ever changed the command line code encoding parameter in the registry
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:
@echo offline at the beginning of the file specified as a value of the entry. @Pankaj Absence of that line makes every bat file print some extra output which breaks many different tools that call and parse output of a bat file.
Just little addition to the answer from Anton Kudryavtsev:
Check that there is no
Autoran parameter in registry:
Its' deletion solved the error
The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe" but was not the same version as initdb in my case
(checked in Windows 10 x64 and Postgress 14.5 .exe installer)