PostgreSQL Database Cluster Initialisation Failed Solution

by
Inf

I’ll keep this one short and sweet. For those of you that have tried to install PostgreSQL (mine was 8.3.7-1) on Windows Vista and got the error Database Cluster Initialisation Failed error at the end of the install, read this.

The problem is that Vista has some safety features associated with setting permissions on the Program Files folder. Basically, even if you are an admin, you can’t change permissions on some folders like Program Files and Windows folder itself. This causes initdb to be unable to create some folders and the database cluster. What this means for you is that you need to install PostgreSQL in another folder that is not inside Program Files.

By the way, if you have forgotten your Postgres account password while installing the first time, just open a Command Prompt in Vista (If you don’t know how, Google for it). Then type the command “net user”. You will see a list of users on your computer. Find Postgre’s account. It’s usually “postgres“. Then you need to change its password by typing “net user postgres new_password” where new_password is… well, a new password for the account. You will be needing that postgres account during install. You will need admin privileges to do this change however.

Firstly, uninstall any failed installations. Use the Control Panel or the PostgreSQL installer in the install folder.

During the install, you will be prompted to choose where you want to install the program. Just select a location in another place. Like “C:\PostgreSQL” or something similar. It may even be on your desktop. But not inside Program Files. Not inside Windows folder. However, it’s not as easy. Bear with me.

After the install, you will still see that darned error message (or something like non-fatal error occured). Do not despair!  (For Windows Power Users, we are just assigning Full Control permission to Postgres account on the new PostgreSQL install folder). For other users, read on if you don’t know how to do it.

Go to where you just installed PostgreSQL.  In this case, the C: drive. There, right-click on the folder (usually called PostgreSQL), and go to Properties – Security tab. Click on the Edit button. You will now see some usernames and other stuff. Click on the Add button. In the “Enter the object names to select” box, enter “postgres” and press Check.  Postgres’ user account should appear there. Click on Ok.

Now from the “Group or Usernames” box, select the Postgres account. In the window below, with lots of checkboxes, assign permission “Full Control” in the Allow Column to it. Note, if you don’t want to allow full control, just give it read/write. But I just went ahead and gave it Full Control. (I was tired and annoyed. The “World’s most advanced open source database” had failed to install!). Click on Ok and wait a bit for permissions to be applied.

Then, just do a re-install. Do not uninstall anything. Just run the setup again. It’ll say that a PostgreSQL install folder already exists and other stuff. Just click on Next until the install finishes. If you see “file cannot be copied” errors, click on the “ignore” button when needed.

That’s it. PostgreSQL should be up and running on Vista now. Hope it works for you too as it did for me, and that my guide is helpful to anybody. If it works, or if you have other solutions, let us know. Thanks for reading! :)

  • Guivan

    thank you soooo much!

  • http://www.geekscribes.net InF

    Glad that it works for you! :)

  • http://deformacionamientacion.wordpress.com placer

    very very very helpful

  • spinLock

    Thank you!!

  • aaron

    Thanks dude! Helped me too!

  • ocakici

    Thanks a lot. Worked like a charm. Instead of waiting for the first installation to fail though, I created the PostgreSQL folder beforehand, and modified the rigths on the folder right after I entered the posgres passwords which creates the user at that point.

  • armin

    Nice Job, dude!!

    Thanks!

  • schilkschi

    Does not work for Windows Server 2008.
    thx anyway

  • http://www.geekscribes.net InF

    Sorry… I have only tested this with Vista. I had to do an assignment on PostgreSQL and had to get it working. I don’t promise the solution works for everybody, but it did for me.

  • kaatil

    thank u so much bro.. indeed a great help.. more than a surprise when u have surfed a million sites to get the output.. i specillay liked that line :”I was tired and annoyed. The “World’s most advanced open source database” had failed to install!”..

  • http://www.geekscribes.net InF

    Thanks to you, sir, for reading. :)

  • http://www.artisit.com jhurff

    Works for Windows 2003 Server too! Thanks man!

  • http://www.piramide.lt Mantas

    ”I was tired and annoyed. The “World’s most advanced open source database” had failed to install!” – I so agree with you. Took me 1,5 hours. After reading your guide, still this thing doesn’t work for me. Running on Windows server 2003

  • Fabio

    Thank you!! Perfect!!

  • http://rosewkaranja.posterous.com Rose

    You are awesome! Thanks!

  • ps

    Using windows 2003, still doesn’t work with the above fix.

  • http://www.geekscribes.net InF

    @Ps: Sorry… I tested only with windows Vista.

    You could try running initdb manually. See if it works, or if any errors give pointers as to what the problem is.

    Refer to this link: http://www.postgresql.org/docs/8.3/interactive/app-initdb.html

  • Tom

    Man, Thank you soooooo much!!!!!!

  • angle

    jaisa apne likha hai hamne karke dekh liya phir bhi wahi problem aa rahi hai.PostgreSQL Database Cluster Initialisation Failed bataiye kya kare

  • rah

    Thank you so much.. it’s really help full…

  • http://alert-grid.com Lukasz

    You’re the Man of the Day.

    Thanks a lot!

  • http://www.geekscribes.net InF

    @Lucasz: Glad I could help! :)

  • Simone

    Oh,my GOD!!! AWESOME!!! Your guide works with Win 7 Pro 64 bit too!!! Thank you so much!!

  • Camote

    nice, nice… it didn’t work on me…

    Thank You…

  • Camote

    after a couple of minutes, it works fine.. so not only nice, nice..

    I would say “It is very nice that I went to this site…!”

    Thank You Very Much…!

  • http://www.geekscribes.net InF

    Hehe great! Glad that it worked for you. And thanks for reading! :)

  • Phil

    I had similar problems installing 8.4 on 2008 Server r2 x64.
    I tried to install it to a different location but it was still trying to write files to the program files folder, probably a registry entry still there from a previous failed attempt.
    Once I changed the permissions on the postgres folder inside program files it worked.
    Thanks for your help

  • Pingback: Anonymous()

  • jose.rob.jr

    Thank you!!!!

    It worked, I’m using Windows 7 64 bits :)

  • http://www.sistemasmx.com.mx ISC Manuel Silva

    thanks a lot. this is the solution what i would find

  • Tondo

    Nice, Win7 64. Thx man!

  • Marcelo

    Fantastic! I´m was looking for a solution to these and never found. Finally!!! PostgreSQL 9.1 installed perfect now in my Win 7 32bit!! Thanks Inf!

  • Sampath R

    very helpful buddy i am very glad to get it installed thank you so much for your post suggestion.

  • Talaksiew

    Very interesting and helpful information.

  • Jasonburmeister

    awesome thanks

  • Abc

    Thank you :)

  • Pingback: Cannot install PostgreSQL 8.4, 9.1 on Windows 7 64bit - now using 8.2()

  • MikeD096

    On Windows 2008 R2 Server 64-bit, I had to add “Everyone” with full permissions to the C:PostgreSQL folder. Thanks for the write up!

  • Carlos David

    THANK YOU!!!

  • Philhu5791

    It worked, thank you very much! But I can’t install postgis in the administrator account. Then I log in the postgres account, installed postgis successfully. Every thing is fine in posgres account, but I still can’t use postgis in administrator account.

  • N3mnik

    tnx for helping

  • umit

    thank you soo much :)

  • mahesh

    Thanks you For the Help.

  • sbransky

    Thank you! – this was driving me nuts. I cheated in my case and just made the postgres user a local admin, though. I actually thought that would have fixed it the first time – the location had me stumped completely.

  • http://twitter.com/sathyaincampus SathyaNarayanan S

    Thanks man!!! You saved my day!!!

  • Ankit Tandel

    Yaar thank you very very very much

  • http://www.facebook.com/jameswm1 James Wallis Martin

    Installed on both a development server (with AD) and a production server (with IIS only) both running on Windows Server 2008 SP2 and installed as user with Domain Admin permission on dev server and as Administrator on production server. It worked fine on the dev server, but failed on the production server until I added the postgres user and full control to the C:Program FilesPostgreSQL directory and subdirectories (but needed subdirectories already defined prior to running the installer) then it ran with a non-fatal error but worked.

  • galvanjpablo

    It worked! Thanks, could not continue without this!

  • Débora Firmani de Chile

    excelente… despues de varios días de búqueda, por fin encontré la solución =)… gracias.

  • fernando

    Funciona en windows 8 para la versión postgres 9.2 !!! :D Gracias por la informacion !!