Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
    
see install log (it should be somewhere on disk, probably in %TEMP%) –  filiprem Jan 5 '12 at 22:41
    
Please see pertinent log output. –  Larry Eitel Jan 6 '12 at 0:03
    
Does the postgres Windows user have full read and write privileges on C:\PostgreSQL\data? –  a_horse_with_no_name Jan 6 '12 at 8:40
    
Yes, AND per a suggestion elsewhere, I gave Users Modify permissions to that directory. –  Larry Eitel Jan 6 '12 at 11:39
    
@LarryEitel: but "Failed to ensure the data directory is accessible (C:\PostgreSQL\data)" seems to indicate otherwise. –  a_horse_with_no_name Jan 6 '12 at 12:30
show 3 more comments

migrated from stackoverflow.com Jan 5 '12 at 23:47

This question came from our site for professional and enthusiast programmers.

5 Answers

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:

  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

  4. Add the postgres user to the Administrators group
  5. Add the postgres user to the Power Users group
  6. Run a command window as the postgres user

    runas /user:postgres cmd.exe
    
  7. Run the install file from within the command window.

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

    This should run the installation successfully.

  8. Remove the postgres user from the Administrators group.

share|improve this answer
    
Thank you for the feedback. Unfortunately, I have since shifted this project to Mongodb. I am not in a position at the moment to confirm your suggestion. –  Larry Eitel Aug 9 '12 at 14:39
    
I want to confirm that the solution worked for me. Setup: Postgres 9.1 64 bit and PostGIS 2.0.1 x64 –  Chris Sep 13 '12 at 14:47
    
This is a well-known issue with re-installation of PostgreSQL that is running as a service, and I have personally run into the situation that this answer addresses. The installer leaves behind an account upon removal or upgrade, but the 2nd installation does not factor this in; the resulting credential disparity between installations creates havoc. The most-common answer is the one Imraan gives; un-install, remove the offending account, then re-install. –  Avery Payne Sep 13 '12 at 22:43
    
@AveryPayne: alternatively: remember the correct password for the postgres service account. I have installed Postgres a lot on systems where it was already installed and never had a problem with an existing service account. The wording in the installer could have been improved though (with 9.2 Postgres doesn't use an explicit account any longer btw) –  a_horse_with_no_name Oct 2 '12 at 21:39
add comment

In my case (as I saw from the postgresql.log file in %temp% folder of Windows), it was because the installer was unable to find doskey.exe even though the path to c:\windows\system32 folder was given in the environment variable path of windows.
So I opened up a command prompt, typed set PATH=%PATH%;c:\windows\system32 and ran the installer from the command prompt itself. It worked! :)

share|improve this answer
add comment

None of the above worked for me. I had no use postgres.

So I deleted/uninstalled everything. Ran cmd as administrator.

Then ran the installer from command line (as admin) and selected a completely new location for the data directory.

I have now succesfully reinstalled postgres, after half a day of jiggery pokery.

share|improve this answer
add comment

I had the same error message when trying to install 9.2.4. My issue was because even though the Win2k8 server had %SYSTEMROOT%\system32 as part of the path, no programs could "see" anything in C:\Windows\system32. The installer heavily uses icacls.exe during the init routine. Since my path was screwed up, the installer bombed out.

Once I explicitly added C:\Windows\system32 to the SYSTEM's Path environment variable and re-ran the installer as an admin, everything worked fine.

share|improve this answer
add comment

This problem has to do with write permission on folder. Create the folder / data into PostgreSQL \ 9.2 for example, and give full permission to the user. Try reinstalling again.

share|improve this answer
add comment

protected by Paul White 17 hours ago

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.