HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMajor

PostgreSQL: The database cluster initialization failed

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqlthedatabasefailedinitializationcluster

Problem

Both C:\PostgreSQL and C:\PostgreSQL\data have postgres user with full access and admin rights.

I ran postgresql-9.1.2-1-windows.exe from postgres user as admin. Target C:\PostgreSQL

Every way I try, I get "The database cluster initialization failed."

Questions

  • Is it OK to run everything w/o being a Windows Service?



  • Is there a work-around to install as Windows Service?



I am trying to setup PostGIS to work with GeoDjango.

I was able to manually install PostGIS. New to PostgreSQL and I am having a crisis of confidence over all of this. Coming from MySQL to PostgreSQL for the first time.

Pertinent log output from C:\Users\Larry\AppData\Local\Temp\install-postgresql.log:

WScript.Network initialized...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C: (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C:\PostgreSQL (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C:\PostgreSQL\data (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can write to the data directory (using icacls) to  Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Failed to ensure the data directory is accessible (C:\PostgreSQL\data)
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb


Suggestions?

Solution

I had the same issue installing 9.1.4 on Windows 7. I managed to find a solution online that worked.

The steps I followed are:

  • 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 


-
Add the postgres user to the Administrators group

net localgroup administrators postgres /add


-
Add the postgres user to the Power Users group

net localgroup "power users" postgres /add


-
Run a command window as the postgres user

runas /user:postgres cmd.exe


-
Run the install file from within the command window.

C:\Download\postgresql-9.1.4-1-windows.exe


This should run the installation successfully.

-
Remove the postgres user from the Administrators group.

net localgroup administrators postgres /delete

Code Snippets

net user postgres /delete
net user /add postgres <password>
net localgroup administrators postgres /add
net localgroup "power users" postgres /add
runas /user:postgres cmd.exe

Context

StackExchange Database Administrators Q#10241, answer score: 22

Revisions (0)

No revisions yet.