- PostgreSQL Installation on Windows 8.1 — database cluster initialisation failed
- Pg install: “The database cluster initialisation failed”
- The database cluster initialization failed postgresql windows
- Error while installing postgreSQL “cluster initialisation failed”
- Getting Database cluster error while installing PostgreSql 12 on Windows 10
- 1 Answer 1
PostgreSQL Installation on Windows 8.1 — database cluster initialisation failed
I’m trying to install PostgreSQL 9.6.2 on my computer via installation package from EnterpriseDB.com. And everytime I get this error at the end:
I have done some googling and found a few «solutions» to this issue, but none of them worked for me. I’m using Windows 8.1, the «normal», not «Pro» edition. Most of these solutions were for Win 7 or Vista. Reason for installing PostgreSQL is using PostGIS for my attempt at creating map application.
It’s written for Win 7 Pro, so I had to do few things diffrently — for example compmgmt.msc doesn’t contain anything about Users and Groups, so I went to lusrmgr.msc — but it said to me that it’s not usable for my version of Windows (i would probably need Pro version). So i created new user via Settings, granted him admin rights via Control panel and tried to install it via CMD as written in the instructions. Well, didn’t work, still got the same error.
It’s for Windows Vista, but I gave it shot anyway. At first, I installed it in different folder outside Program Files (C:\Hry\postgres), got the same error. Then I tried to create user postgres there as written in the article, but when I wanted to assign rights to the folder, I got error with stm like this (my Win is not in english, so I’m translating it in the best way i can):
And the same one for every sub-folder of postgres. I still tried to re-run installation into the same folder as advised in the article, but nothing, still same error.
I’m including the last lines from install-postgresql log, if it will help someone with identifying where the problem is:
At this point, I’ve spent a few hours on this and I’m running out of ideas. Any help would be greatly appreciated. Thanks very much in advance.
Pg install: “The database cluster initialisation failed”
(Note: This question has been compeltely rewritten from its original form, so it reflects the actual problem and will help others find a solution to the same issue).
I still haven’t been able to successfully install PostgreSQL on my Windows 7 Ultimate x64 computer. See this prior question for some history.
I did a fresh instillation of 9.2 and the only error I got was this one:
«Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed».
This occurs even after I do a complete manual uninstall of PostgreSQL and pgAmdin-III:
- Ran the PostgreSQL uninstaller, which failed with the error Error stopping service postgresql-x64-9.2 .
- Removed all the PostgreSQL-related registry entries for PostgreSQL under HKEY_LOCAL_MACHINE\SOFTWARE and HKEY_CURRENT_USER\SOFTWARE
- Removed the postgres user account using net user postgres /delete in an Administrator command prompt (shift-right clicked on «Command Prompt» in start menu, chose «Run as administrator»)
- Removed the postgres user profile
- Deleted the C:\Program Files\PostgreSQL\ directory, including the data directory within %appdata%
- Removed some PgAdmin-III registry entries that pointed to PostgreSQL
- Removed the service account for postgres from services.msc
When I reboot and try the installer again it fails with the same message.
The database cluster initialization failed postgresql windows
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! 🙂
Error while installing postgreSQL “cluster initialisation failed”
The setup: Windows 10, postgreSQL 12.3, all the values are default.
The problem: While installing postgresql 12.3 I get an error message at the end of the installation: «problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed» When I then try to run the SQL shell (through the start menu), and I press enter to default all the values, it gives me a connection refused error.
When uninstalling postgreSQL, I also get an error message: «Error deleting service postgresql-x64- 12» two times.
What I tried:
- installing postgreSQL in a directory C:\postgresql (as opposed to in the Program files)
- There was no service related to postgreSQL, so I added it manually with this commandline (openened cmd as admin in the postgresql bin directory)
pg_ctl.exe register -N «PostgreSQL» -U «NT AUTHORITY\NetworkService»-D «C:/Program Files/postgresql/pgsql/bin/pgsql/data» -w
- Uninstalling/Reinstalling postgresql, rebooting the PC
- Disabling all firewalls
- Checking that the COMSPEC environement variable is valid with echo %COMSPEC% and «%COMSPEC%» /C «echo test ok»
- Ran regedit, went to the registry entry «HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services», there was a postgreSQL service (after adding it manually)
Getting Database cluster error while installing PostgreSql 12 on Windows 10
When I tried to install PostgreSql 11/12 on my windows machine I was getting the below error :
Error while initializing database cluster
Below are the details — Port No — 5432 Installation Location — I have tried installing it in C:/ProgramFiles and also directly in C drive Password — test123 I am running the installer as administrator I have access to Temp directory as well. I have tried moving data folder outside of the main folder. Below are the solutions I have tried —
Below is the error in log file:
Could someone please help me in this issue?
1 Answer 1
On Windows I typically don’t use the installer any more as its attempt to set privileges correctly is laudable but seems to create more problems than it solves (especially with computers that a part of a Windows domain seem to suffer from that).
Manually running initdb seems to be more robust, but you will have to fix the permissions on the data directory yourself, e.g.:
If you want a Windows service, this can be done using pg_ctl:
The Windows service will run using the Windows «Local System» account which sometimes is seen as dangerous — but isn’t as dangerous as described in that SO answer, because Postgres will drop all elevated privileges when it starts the service.