Failed to load sql modules into the database cluster during PostgreSQL Installation - postgresql

I have attempted to install PostgreSQL 9.4 and 8.4 multiple times and it is failing no matter what I have tried. I am attempting to install on Windows 7 SP1 x64. After each failed install I have uninstalled and deleted the installation folder to start fresh.
Each time I attempt the install I get an error pop up near the end of installation that says:
"failed to load sql modules into the database cluster".
Then another error pop up displays immediately after that says:
"Error running post install step. Installation may not complete correctly. Error reading C:/Program Files/PostgreSQL/9.4/postgresql.conf"
I have attempted installation with the following actions:
Always installed as administrator
Turned off all virus protection and windows firewall
Changed the installation directory to something other than the Program Files directory.
Changed the data directory to something other than the installation directory of postgres
None of the actions above have helped and I always receive the error. Any help that someone can provide would be greatly appreciated!

Encountered a very similar problem that OP is reporting today while installing Postgres 9.4.
It turns out that the password generator I was using has made a password that contains non-alphanumeric characters. ("^") I believe was the culprit in this case. Removing that allowed the installation of Postgres 9.4 (Windows 64 bit) to complete.
Very easy fix once you've found it, but the error message that comes up is not descriptive, so in this case I didn't notice at first what I was doing wrong.

I was getting this same error when trying to install PostgreSQL v9.4.4 on Windows 10 Pro. Starting with a solution hosted on Stack Exchange, I came up with the following steps that allowed the installer to run successfully:
1) Create a new user account, called postgres
2) Add the new account to the Administrators and Power Users groups
3) Restart the computer
NOTE: I added step #3, since step #4 didn't work without it
4) Run a command prompt as the postgres user, using the command:
runas /user:postgres cmd.exe
5) Run the installer from the postgres command window
6) Delete the postgres user account, as well as the user directory
NOTE: I added step #6, since the postgres account is not required after installation

What worked for me is, during the install, specifying a Postgre SQL data folder that's outside of any Windows user profile directory (C:\Users), such as C:\postgres-data.
My setup:
Win 10 Pro
PostgreSQL 9.5 RC1
I ran into this issue when I tried setting PostgreSQL's data directory somewhere under my user profile's directory, such us somewhere under "My Documents".
I tried Jeff G's solution and it didn't work at first. It worked only when I kept the data directory as the default (C:\Program Files\PostgreSQL\9.5\data). So then I tested further and tried setting the data directory to somewhere outside of any user profile directories (i.e. somewhere that isn't under C:\Users). For example, C:\postgres-data and this worked.
I then just tried using that directory with my default user, and not bothering with the postgres temp user as outlined in Jeff G's solution and that also worked. So in the end, it had to do with my data directory being somewhere under C:\Users. As long as it was outside of that, it worked.

None of these answers here helped me, finally I solved this problem by creating the folder before the installation (C:\PostgreSQL\data) and giving it full access for the group "Users".
Windows 7 x64, postgresql-9.5.2-1-windows-x64

Hope It's Work.
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
4.) Add the postgres user to the Administrators group:
net localgroup administrators postgres /add
5.) Add the postgres user to the Power Users group
net localgroup "power users" postgres /add
6.) Run a command window as the postgres user:
runas /user:postgres cmd.exe
7.) Change user postgres and install postgresql
8.)Back your and remove the postgres user from the Administrators group.
net localgroup administrators postgres /delete

I had the same error ("Failed to load SQL modules into the database cluster.") when installing on W2K12R2 using the EnterpriseDB installer linked to from the PostgreSQL Windows download page. I tried running the installer with admin privs, and using the postgres-user solution offered by Jeff G, but neither worked. Finally I tried the second installer, BigSQL, and that installed without issue.

When installing PostgreSQL, do not use the following symbols in your database's admin password: %, <, and >.
Bug report and problem solution here

Changed the data directory to something other than the installation directory of postgres
Make sure NETWORK SERVICE has read/write permissions on that folder, the installation was failing for me until I did this.

I had this issue too with 9.5 and got around it by:
Installing with the default data folder.
Making sure my new data folder had full control access for the "NETWORK SERVICE" account.
Then changing the default PGDATA folder as per this instruction: https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows

I had the same problem, and noticed that some Postgres .bat files were opening in a text editor. Text editors opening files during installation isn't too uncommon, but I noticed these batch files were setting directory permissions. I then found that .bat files were set to open in a text editor (Notepad++) by default. I changed the default program for .bat files, uninstalled Postgres, re-ran the installer, and it worked perfectly. Hope this helps.

I had the same problem before. I solved this by installing Visual Studio C++ Express first.

I had the same experience as #gomisha. #Jeff G's solution did not work for me no matter which user ran the installer.
As long as the target data directory was anywhere under c:\users, the install or database cluster init would fail.
I was successful after creating c:\postgresql-data and ensuring that the postgres user had full access in the 'effective access' tool.
Note: I did not use control userpasswords2 to set up the postgres user; I did it through the traditional crappy Windows 10 user wizard that tries to make the user sign up for hotmail. I did run the install as postgres.

I was getting this issue with the BigSQL windows installer PostgreSQL-9.6.5-1-win64-bigsql.exe
The problem turned out to be that my system path was too long. After removing some uncessary junk from my System Path, and then reinstalling, the problem was gone.

One of the answers here is the only thing that worked on my machine:
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.
Credits to the user.

Go to services.msc
Search for postgres service
Go to Log On tab
Select local account
Profit

The alternative solution for problems with PostgreSQL installer is setting this up with a Docker.
Install Docker Desktop
https://www.docker.com/products/docker-desktop/
Start installed Docker Desktop
In PowerShell, run:
docker pull postgres
In PowerShell, run:
docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=mypassword postgres
Now you can connect to the Postgres server for example with pgAdmin on the same machine, using:
host: localhost
port: 5432
maintenance database: postgres
username: postgres
password: mypassword

I think this would be better as individual comments above, but I don't have the required rep. I just spent days on this, with Postgres 10 on Win 10 Creators. My "answer" was to let Postgres put the data in its default install folder instead of my User folder (where it would be automatically backed-up).
1. This problem can happen with no reported install errors at all. On my very first try, I saw:
Failed to load SQL modules into the database cluster.
But that seemed to be due to:
Executing C:\Users\loren\AppData\Local\Temp\postgresql_installer_aee8e5a76f\vcredist_x64.exe /passive /norestart
Script exit code: 3010
MSI (s) (AC:FC) [14:21:35:341]: Product: Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.40660.
Restart required. The installation or update for the product required a restart for all changes to take effect.
The restart was deferred to a later time.
Restarting Windows after the failure of the rest of the Postgres installation did not let Postgres run.
Once VC was in place, uninstalling and re-installing Postgres (still with its data in my User folder) completed with no reported errors. But every attempt to access it, by any means, still resulted in something like this:
C:\Program Files\PostgreSQL\10\bin>psql
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
The RawCap sniffer showed TCP SYN followed immediately by RST,ACK on localhost for both v4 and v6 for each try. Netstat did not see port 5432 in use at all. All Postgres runtime logs were totally empty. In Windows Services, I could manually start the postgresql-x64-10 service, but it immediately stopped itself, with the note that some services do that normally.
2. I tried moving the data directory via the Postgres wiki procedure. Apparently for Postgres 10 it is incomplete. It does not deal with:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-10\Data Directory
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Services\postgresql-x64-10\Data Directory
C:\Program Files\PostgreSQL\10\pg_env.bat
C:\Program Files\PostgreSQL\10\scripts\serverctl.vbs
But fixing every data file instance I could find did not let it run. And even after fixing all those, and uninstalling and re-installing again with the default location, the new pgAdmin4 somehow still remembered my original User data directory location!
3. I did not try giving NETWORK SERVICE read/write permissions on my User folder. Once the default install worked I wanted to get on with my original project... Maybe that would have worked.

Related

Connect Postman to Postgres

There is a problem.
I need to access Postgres Database from Postman. Database isn't local, it is on a server, but I have full connection string (host, db_name, user_name/password, scheme).
Any chances to do it?
I tried PostgREST, but I can't install it. I have LIBPQ.dll is not found error. I installed it but it was no help, I still have 0xc00007b error.
So that I can't install PostgREST.
Should I install it on the server where DB is located?
And is there any other way?
update: I managed to overcome all the errors (here is the note how to overcome 0xc00007b error: https://postgrest.org/en/stable/install.html).
Now I can call postgrest from cmd with the flag --help, but it's still not connected to the database.
update2: I managed the connection by putting postgrest.conf filled file in the same directory as postgrest.exe file and running in from cmd.
search for app and browser control in start menu, then select exploitation control :
set randomize image ASLR to off

pgagent - not running jobs - pgpass file is correct - postgresql

I have Pgagent installed on my Debian OS. Along with Postgresql 9.4.
I have checked .pgpass file as this seems to be the most common cause for a job to not run.
host port 5432 database = * username = postgres password = xxxx.
for both local and the remote host. The database I'm trying to set a job for is on a remote host.
I made sure it was enabled. It's just a simple INSERT script that should repeat every 5 minutes.
No errors are being triggered that I can find. Any ideas of what would cause the job not to run at all - even when selecting 'run now'?
Check postgre db, pgAgent Catalog, pga_jobsteplog
IDK about Linux but I had similar problem in windows where the thing won't run and it doesn't raise any notice on the error even after doing RUN NOW. The only error i could find out was that if i click on the job and click on statistics, i could see like shit ton of times it ran and everytime it ran, its status was F.
The reason for this failure is becuase the pgagent couldn't connect to the main database of postgresql.
The services of pgagent isn't running at all (as we can see this information under services in task manager in windows).
Forcing the service to run would create a failure which can be viewed in the event manager in windows.
To solve this issue, first try putting that pgpass.txt file in the environment variable (if not automatically put), if this didn't work, then what I did was to uninstall and delete all possible folders of Postgres, pgagent, and pgadmin, clearing out all temp files, clearing out registry details which have been put by Postgres, pgagent, and pgadmin and also from environment variable. Then reinstall it and it would normally work :)

postgres.app can't find database with my username

When I click Open psql on the Welcome to Postgres window with the fancy blue elephant, it opens a terminal and I get this command and output:
Tyler-Singer-Clarks-MacBook-Pro:~ Tyler$ '/Applications/Postgres.app/Contents/Version
/9.3/bin'/psql -p5432
psql: FATAL: database "Tyler" does not exist
Why would this database exist or not exist? (I'm not really sure what is responsible for this database's existence, and thus where I should be looking in order to fix this issue)
EDIT:
and the Welcome window says "You now have a PostgreSQL server running locally." And it did not give me an error about not being able to use port 5432.
http://postgresapp.com/documentation/install.html
I uninstalled postgresql with brew uninstall postgresql and uninstalled Postgres.app by dragging the elephant from Applications to Trash and Emptying Trash. The key thing is to then follow the instructions in the above link and remove ~/Library/Application\ Support/Postgres. Only then did installing postgresql with brew install postgresql and Postgres.app with the installation instructions in that link finally work.
Classic, "Turn it off, turn it on" solution, but gotta do it fully and correctly.
Try executing createdb Tyler from the terminal.
PostgresApp is supposed to create a database with your user name during its setup. Apparently this sometimes fails and requires manual creation.
More info: PostgresApp Issue #139

No postgresql user created after new Windows install

I'm trying to use postgresql with Rails so I can run locally before deploying to Heroku. I installed the latest version of postgresql (9.2.4) from enterprisedb.com.
When I try to double click the database in pgAdmin III, it asks for a postgresql password. There is no Windows postgresql account in the user settings. I did notice that during my subsequent uninstallation of the application, the uninstaller referenced a service user account "NetworkService."
If I try to run the command line psql command, it asks for a password, then it complains that authentication failed for (my windows login account name). I tried entering my usual Windows account password, and that didn't work.
What's going wrong here? I've read many posts of people running into password/account issues with this database.
There is no Windows postgresql account in the user settings.
The installer for 9.2 doesn't create a postgres Windows user account. People were having too many problems with the service account password, getting confused between the service account and the postgres database account, etc. It now installs and runs as NETWORKSERVICE by default.
You will have set a PostgreSQL database password when you installed. You must log in to PostgreSQL as the postgres user with the password you gave during installation.
With the help of bma, I was able to get my Rails application running on Windows by following these steps:
Install postgresql for Windows.
Open the pgAdmin III application from the Windows Start Menu.
Click on the File menu, click Open pg_hba.conf
Browse to C:\Program Files (x86)\PostgreSQL\9.2\data\pg_hba.conf.
Double click each of the rows and change md5 to trust

postgresql installation failed

I tried to install postgresql 8.4 in my windows 7 (64 bit). But it fails with following messages in log
Initialising the database cluster (this may take a few minutes)...
Executing cscript //NoLogo "C:\PostgreSQL\8.4/installer/server/initcluster.vbs" "postgres" "postgres" "****" "C:\PostgreSQL\8.4" "C:\PostgreSQL\data" 5432 "DEFAULT"
Script exit code: 1
Script output:
CScript Error: Can't find script engine "VBScript" for script "C:\PostgreSQL\8.4\installer\server\initcluster.vbs".
Script stderr:
Program ended with an error exit code
Error running cscript //NoLogo "C:\PostgreSQL\8.4/installer/server/initcluster.vbs" "postgres" "postgres" "****" "C:\PostgreSQL\8.4" "C:\PostgreSQL\data" 5432 "DEFAULT" : Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
The database cluster initialisation failed.
Creating Uninstaller
Creating uninstaller 25%
Creating uninstaller 50%
Creating uninstaller 75%
I have googled about this and run the command 'regsvr32 vbscript.dll' and it shows the message 'DllRegisterServer in vbscript.dll is succeeded', but it haven't solved my issue.
Also I set the default value for {B54F3741-5B07-11cf-A4B0-00AA004A55E8} in registry to the file path of vbscript.dll, but it also haven't solved my issue.
How to fix this issue?
Following link solve my issue
http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/
The article text:
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! :)
I got the same result installing "postgresql-9.2.3-1-windows-x64.exe" on Windows 7 Enterprise
and the problem get solved when I change the installation path.
Try to install into "c:\postgresql" instead of "c:\program files\Postgresql"
Good luck
For me the problem was that PATH variable did not have C:\Windows\system32 and so it did not find ICACLS command to change folder permissions. So the solution is to add C:\Windows\system32 to system PATH variable (if it does not contain it already):
Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables
Under "System variable" find and select "Path"
Click "Edit..."
Now if value does not contain path to system32 append string ;C:\Windows\system32 (or wherever your windows path is)
I've pulled shin's link from the google cache:
Original link:
http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/
Cached link:
http://webcache.googleusercontent.com/search?q=cache:RXu-5-ZzfcgJ:www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/+&cd=3&hl=ro&ct=clnk
PostgreSQL Database Cluster Initialisation Failed Solution
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!
Solution:
• Uninstall PostgreSQL
• Run command: net user postgres /delete
• Click: Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all “Unknown User” instances that seem to be left from PostgreSQL installation.
• Run: compmgmt.msc -> Click Local Users and Groups -> Users -> New User… -> User name: postgres, Password: postgrespass -> Create
• Run: compmgmt.msc -> Click Local Users and Groups -> Users -> postgres ->Member of -> Add… -> Administrators -> OK
• copy the PostgreSQL installer postgresql-8.4.9-1-windows.exe to C:\
• Run: runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully.
• Run: compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove
• Run: compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add… -> Power Users -> OK
Your Windows install is a little borked, and you will need to re-register the VBScript engine to get the installer to run.
Edit: I'm blind, the post author had already tried this.
See:
http://wiki.postgresql.org/wiki/Running_%26_Installing_PostgreSQL_On_Native_Windows#The_installer_exits_with_a_runtime_installation_error.3F
I had the same problem when trying to install PostgreSQL 9.3.5-3 on a Windows 7 x64 machine (not joined to a domain) in a folder, created on the root, with full access to everybody. The problem was solved by not using ä in my password, so avoid using non-English characters in your password.
This message still occurs in Postgres v9.3.1.1.
For me, the problem was running the installer under the "Administrator" account. This doesn't work. Run it under an administrator account, avoiding the built-in "Administrator" account.
I don't really know what it's usually called, but it's the one that already exists on a fresh install; the one that cannot be changed to a Standard User; the one whose profile is stored in C:\Users\Administrator. Turns out it was a bad idea using this account; learned it the hard way.
(Windows Server 2008 R2 64-bit)
Hey guys the answer is very simple just install postgresql on another folder outside program files. it prompts a non fatal error and proceeds to with the installation...
I have solved the same problem on Windows Server 2003 and postgres 9.2.9-3 by creating directory for installation beforehand, and giving full access on it to group "Users".
The answer is very simple, move the downloaded .exe file to some other folder . for ex: c:\postgres and try to install it.
your issue is due to some admin privilege issues
There seem to be many reasons cause the installation fail.
In my case, I'm using Windows 10 home edition, which has no advance user group control,
so a lot of solutions above doesn't work for me. And I guess this is why the installation fails.
What I do is just using BigSQL's installer instead of EnterpriceDB's installer,
Choose the second installer in posgresql download center
Or visit BigSQL directly.
After some struggle I came across this post. I struggled some more time and I think I finally figured it out with the help of all the invaluable input from my predecessors in this post.
My case
It's November 2018.
PostgreSQL 11.1 Winodws-x64 from EnterpriseDB as suggested by postgresql.org
Tried to install on Windows 10 (both Home and Professional)
I tried several constellations and boiled down the process to this:
Pre-installation
Uninstall any failed installations.
Add a local user "postgres" (lowercase worked for me) to your computer, assign a SIMPLE password and administrative rights. Do avoid special characters at all expenses, stick with english letters (upper and lowercase) and numbers only.
Add a folder on your computer OUTSIDE the "C:\Program Files" or Windows folder. I chose C:\PostgreSQL
Assign full control over the above folder to the postgres account.
Installation
Run the installer (postgresql-11.1-1-windows-x64.exe in my case)
use the above password and folder when prompted (not the default folder)
Post-installation
For security reasons you should now assign a proper password to the windows-user "postgres" and remove administrative rights from the account.
Test your installation by running pgAdmin and connecting to your server. However, the password for the postgres user you need to connect to the server will still be the simple one you used earlier. You may change it within pgAdmin by selecting the postgres database left, choose Tools -> Query Tool and type ALTER USER postgres WITH PASSWORD '4wligzo748o$%&'; or whatever. Execute with the flash symbol or F5.
But maybe this is wrong altogether and you should rather run a linux vm with postgreSQL server.
Struggling with this problem for days. Finally got help from the EDB team
My problem got solved by doing the following steps :
1) Open the command prompt and go to the following directory:
cd "C:\Program Files\PostgreSQL\10\bin"
2) Once you are inside this "C:\Program Files\PostgreSQL\10\bin" directory execute the following command:
.\initdb.exe -D "C:\Program Files\PostgreSQL\10\data"
3) At the end of this command you will be promoted to execute a pg_ctl command to start the Postgres cluster. Please execute the command and once you get a message as the server started you are all set to use the Postgres database.
Note: Instead of 10 user whatever version you have installed. If the pg_ctl command in the third step gives an error after running it in \bin directory, then try running it in \data directory. After the above process re-run the installer.
I know it is not the the solution but installing 32 bit of Postgres, worked for me
I had the same problem when trying to install PostgreSQL 9.6.2 on a Windows 7 32 bit machine,but i got solution,first just uninstall the installed postgres,then delete the postgres folder from 'c' drive,delete the entry from temp file which resides in "C:\Users\AppData\Local\Temp".Then again installed postgres 9.6.2 that installed successfully.
Had this same problem trying to install on my company computer (PC running Windows 7). If you are not admin on your computer, you need to install it within your personal "User" folder (not in the "Program Files" folder(s) at the root).
If you still can't access Postgres:
Once you'd installed it under your "User" folder, use the 'Run' program and type in "services.msc" and hit enter. In the window that pops up, go down to your postgres installation, right-click and go to "properties". In the "Log On" tab, select "Local System account" then go back to the "General" tab and click "Start". It should boot after that.
After this, I was able to run "pgAdmin" and access the database (after entering the password I used during installation).
I had the same problem today when installing postgres 9.6.19 on windows 10.
Solution: Neither the installation path nor the windows path variable may contain a blank! Near to the end of the installer log file (found in wondows %temp% dir with a name like bitrock_installer_16156.log) i found:
Script stderr: "\UnxUtils\usr\local\wbin\";"C:\Program" kann
syntaktisch an dieser Stelle nicht verarbeitet werden.
where the installation directory i set as well as my windows %PATH% variable contained
C:\Program Files\
Workaround:
open a command prompt as administrator and type:
set path=C:\WINDOWS\system32
PostgreSQL-9.6.10-1-win64-bigsql.exe
And then of course choose a path not containing a blank.
That did it for me.
I encountered an issue where a username with a space in it on windows fails the postgres installation.
To test:
Reinstalled windows 10 home (restored)
Made a user account without the space
Postgres installed successfully
Very frustrating...
check the services: if any folder there postgres related stop it, and change to disable mode.
check regedit: HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER -> software -> remove postgres folder if exists.
In system environment variable: TEMP path location, remove the TEMP folder for both user and system. and Rename the TEMP to TEMP1 or something..
In system environment variable: remove path for postgres if it exists.
Now change the location of postgres.exe file to another drive.
Restart the system
Then Run postgres.exe
create a new installation directory for postgres and put /data outside.
the easiest way i solve this was:
1.- uninstall if you have already installed
2.- delete all files with failed instalations
3.- start windows in secure mode
4.- run installer in secure mode (it pops a warning but ignore) and restart
and that's it when restarted the service was running ok and everything works fine