Questions & Answers

Win 10 Postgresql 11 database cluster initialisation failed

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 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


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.
Answers(9) :

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:

wsl --install

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.

Update Ubuntu:

sudo apt update && sudo apt upgrade

Install PostgreSQL:

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 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:

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.

UTF8 Region Settings screenshot

2023-01-19 00:00:05
How did you discover this? I would have spent days! Thank you soooo much!!!!

Just had this issue with postgres 12 my method to solve it is similar to Atif's but uses the command line:

  1. Uninstall PostgreSQL

  2. Delete the postgres user if it still exists :

    net user postgres /delete

  3. Create the postgres user with a password you can remember:

    net user /add postgres [password]

  4. Add the postgres user to the Administrators group:

    net localgroup administrators postgres /add

  5. 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

  6. Run a command window as the postgres user: (opens up new command window) :

    runas /user:postgres cmd.exe

  7. copy the install file to a location reachable by that user and run it e.g.:


  8. 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

  1. Uninstall PostgreSQL
  2. Delete if you have postgres user
  3. Right click on My Computer / This PC and click on Manage goto Local Users and Groups then Users New User enter Username as postgres and Password (whatever you want) and click on Create button.
  4. Now right click on postgres user and click on properties click on Member of tab and then on Add button here click on Advanced and a new dialog box open for Groups click on Find Now and select Administrators click OK button.
  5. Now open Command Prompt / cmd
  6. here type runas /user:postgres cmd.exe and hit enter
  7. cd path to downloaded Postgresql folder enter
  8. postgresql-x.x.x-x-windows.exe enter (here x reflect release, major and minor versions).
  9. Now repeat step 4 and remove group Administrators and add Power Users
2023-01-19 00:00:05
Current Postgres versions don't need a dedicated postgres Windows user for their installation.
2023-01-19 00:00:05
@a_horse_with_no_name If above error occurred than we've to create a postgres user
2023-01-19 00:00:05
No, you don't have to
2023-01-19 00:00:05
@a_horse_with_no_name This solution works for me if you have any solution than share it here.
2023-01-19 00:00:05
@a_horse_with_no_name seems not to be the case, I needed to flaff around with this in version 12 (added my steps as an answer although like Atif's still manually creating a user). Would love to know an alternative easier solution!
2023-01-19 00:00:05
@Andrew: I haven't created a postgres Windows 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 initdb manually
2023-01-19 00:00:05
@a_horse_with_no_name ah interesting will try that next time, I think with windows you would still need to create a service manually though?
2023-01-19 00:00:05
@Andrew: yes, see e.g. here:

Uninstallation may not remove all registry entries. You may type registry in the taskbar search and open Registry Editor.

Navigate to:


And remove entries pertaining to postgresql.

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

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

2023-01-19 00:00:05
This is the only solution that worked for me.
2023-01-19 00:00:05
This solution worked like a magic. But, I am unable to understand how the Autorun field value matters for postgres to do initdb.
2023-01-19 00:00:05
Thanks, I tried everything mentioned online but once I saw this answer I knew it might be the actual answer as I did change the command line encoding before! went back to default and it finally worked.
2023-01-19 00:00:05
It's not necessary to delete the entry. You can put @echo off line 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: \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor

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)