Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.
like image 331
Hades85 Avatar asked Feb 11 '19 13:02

Hades85


People also ask

Does PostgreSQL work on Windows 10?

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.


4 Answers

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

like image 93
simon Avatar answered Oct 12 '22 14:10

simon


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

like image 31
Anton Kudryavtsev Avatar answered Oct 12 '22 15:10

Anton Kudryavtsev


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
like image 3
Atif Zia Avatar answered Oct 12 '22 14:10

Atif Zia


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

    C:\Download\postgresql-12.4-1-windows-x64.exe

  8. Remove the postgres user from the Administrators group:

    net localgroup administrators postgres /delete

That's it. Hope this is useful

like image 1
Andrew Avatar answered Oct 12 '22 13:10

Andrew