I am getting the following error when trying to install PostgreSQL on my Windows 10 Machine (x64). Can anyone help me troubleshoot? Many thanks! Error screenshot below:
asked Aug 27, 2019 at 14:11
This happened to me as well. Turned out I couldn’t use a Domain user (even though it is an admin on the local machine). I had to log in as a local admin user, and then the installation worked. This is very weird.
answered Sep 15, 2019 at 11:22
zmbqzmbq
8162 gold badges7 silver badges14 bronze badges
I tried installing Postgresql-9.5.19.1-windows-x64 version (downloaded from official page) on Windows 10 x64 and it gave me the same error. I tried executing it with administrator privileges, giving permissions to the temp folder, moving temp folder to another location but nothing worked…
The solution for me was using a different version of 9.5: PostgreSQL-9.5.2-1-windows-x64.
answered Sep 17, 2019 at 14:34
This error happened to me to on PostgreSQL version 11.2
I elaborated in a Stackoverflow post as answer to ‘Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?’ a solution. I mentioned this question thread with answers as being the solution to this error.
But in short it is what you all are saying: reinstall.
But it can be the same or a different version in my experience.
My explanation:
The general thought/assumptions:
It looks like it is pgAdmin (probably version 4) or your admin rights or one of the files mentioned above (postgresql.conf and/or pg_hba.conf).
I had the same error and even a password error (for the correct password) after being a step further by some todo’s and fixes that helped other people in previous versions;
But none of them worked for postgresql version 12.3 and/or postgresql version 11.8
Solution versions:
The only thing that helped after two hours was:
As explained in this post: ‘PostgreSQL Install fail on Windows 10 (icalcs error/acces denied)’ on the superuser forum of StackExchange:
- Uninstall en reinstall postgresql. The official version provided by EDB through this link: postgresql.org/download; Or try a different version if you are sure this one doesn’t work for you. Therefor head to the ‘File Browser’of Postgresql: here
- After reinstall, start pgAdmin from the Start Menu (scroll for the folder and the correct related pgAdmin; an older version could still hang around in the shortcuts and won’t start).
Note: You can keep your data map so nothing is lost!
In my case e.g.: I removed the /data folder from the (Windows 10) [Drive]/Program Files/PostgreSQL/11 and as soon as I uninstalled version 11.2 and reinstalled (earlier removed 12) version 12: when I started pgAdmin4 my former servers ([nameA] and [PostgreSQL 11] and databases ánd the new server [PostgreSQL 12] were there! And the connection was reestablished
Tried:
Earlier tried solutions that did not work in my case:
- Question 37307346 «Is the server running on host localhost 1 and accepting tcp ip connections on port 5432?
- Question 40532399 Unable to connect to server for postgres
- Question 16904997 Connection refused pgerror postgresql and rails
- Question 60532791 Timeout expired pgadmin unable to connect to server note: This was after semi solution of netstat running postgres service (port was not used before that solution; here listed as 4th item, item above).
answered Jun 17, 2020 at 22:47
If you have issues with permissions either after installations or after reinstalling postgres you might find help here.
Make sure you install the correct version for the data folder you have, you can check the version in that data folder under file named PG_VERSION.
- Install postgres with random data directory. If it doesn’t work with old data directory and you get errors about permissions or stuff like icacls then pick a fresh folder and proceed with this post.
- Go to registry editor and then find something like
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\postgresql-x64-11
<- version you installed
change imagepath to reflect the data directory
"C:\Program Files\PostgreSQL\11\bin\pg_ctl.exe" runservice -N "postgresql-x64-11" -D "{DATA_DIRECTORY like d:/db}" -w
- At this point the service might not even start, but check just in case it is magically working at this stage. It won’t log anything or throw any errors so don’t worry, if you do everything right it will work.
- Right click the data folder then go to Properites -> Security tab -> Advanced button
- Toggle the checkbox on the bottom «Replace all child object perm[..]»
- Press Add, and
select principal
on top, then type in the big boxNETWORK SERVICE
To make sure it works try pressing check names, it should underscore it. Then press OK, set all permissions to it. Then OK, OK, OK. You should leave the file properties approving everything.
If steps 4-6 throw out permissions errors read step 7 /
- Try running postgres. If for some reason you cant run postgres at this point. Then run command-line as an administrator, and type in
icacls "{DATA_FOLDER}" /reset /T
this will clear all the permissions that are there no matter what they are. Postgres install ought to be doing that but it’s bugged in some versions. As it was in mine. - Now you can try running postgres service.
- At this point PG Admin didn’t really work but I managed to login using the psql.exe and I’ve dumped all the data.
pg_dump -U {USERNAME} {DATABASE} > {FILENAME.EXT}
Then I’ve uninstalled postgres, restarted PC, then installed the newest version and I’ve recovered the dump.
answered Dec 22, 2020 at 17:10
Had the same problem, but I’m not comfortable downloading installers from unknown sources.
After quite some struggling (including run as different user, install from a session opned with a domain administrator account), the only thing that worked for me was to enable the local administrator command (net user administrator /active:yes), providing a password for it (net user administrator *) and then running the installer.
Hope this helps.
answered Sep 10, 2019 at 13:47
For me, problem was that some files inside Data folder of existing Postgres installation had cleared permissions & ownership information. I was able o fix the problem by going one level up above Data directory and re-setting the Owner of the child directories & files via standard Windows dialog. After that, re-running installer allowed icacls to set permissions & finish the installatio nsuccesfully.
answered Mar 19, 2020 at 5:50
Apparently this happens if you uninstall PostgreSQL and do not delete the «data» directory where your databases are stored. When you attempt to (re)install PostgreSQL, it fails to change permissions on that directory, because it already exists. I was able to work around this apparent bug in the installer by deleting all of C:\Program Files\PostgreSQL manually. But that might not be an option if you have data in there that you haven’t backed up.
answered Mar 27, 2020 at 18:02
We had the same Problem today while upgrading from 12.1 to 12.3.
Installer (EnterpriseDB) stopped with the error while icacls — call because of missing rights…
We even ran it as local administrator.
After stopping the setup the pg — service was removed and rights in pg-data / base — folder were missing.
We run takeown /F d:\PgData12\* /R /A
and startet the setup again. Then it worked without other problems.
answered Jun 11, 2020 at 6:05
My solution was log in with the user caller admnistrator, can’t be other user with permissions, must be the user administrator
answered Jan 18, 2021 at 15:15
I suspect a problem with user rights.
I was able to activate the Administrator account and perform the installation.
-
cmd (Run as Administrator)
-
net user administrator active: yes
-
logout old Account and login Administrator
-
install PostgreSQL
answered Mar 14, 2021 at 9:23
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
I am getting the following error when trying to install PostgreSQL on my Windows 10 Machine (x64). Can anyone help me troubleshoot? Many thanks! Error screenshot below:
asked Aug 27, 2019 at 14:11
This happened to me as well. Turned out I couldn’t use a Domain user (even though it is an admin on the local machine). I had to log in as a local admin user, and then the installation worked. This is very weird.
answered Sep 15, 2019 at 11:22
zmbqzmbq
8162 gold badges7 silver badges14 bronze badges
I tried installing Postgresql-9.5.19.1-windows-x64 version (downloaded from official page) on Windows 10 x64 and it gave me the same error. I tried executing it with administrator privileges, giving permissions to the temp folder, moving temp folder to another location but nothing worked…
The solution for me was using a different version of 9.5: PostgreSQL-9.5.2-1-windows-x64.
answered Sep 17, 2019 at 14:34
This error happened to me to on PostgreSQL version 11.2
I elaborated in a Stackoverflow post as answer to ‘Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?’ a solution. I mentioned this question thread with answers as being the solution to this error.
But in short it is what you all are saying: reinstall.
But it can be the same or a different version in my experience.
My explanation:
The general thought/assumptions:
It looks like it is pgAdmin (probably version 4) or your admin rights or one of the files mentioned above (postgresql.conf and/or pg_hba.conf).
I had the same error and even a password error (for the correct password) after being a step further by some todo’s and fixes that helped other people in previous versions;
But none of them worked for postgresql version 12.3 and/or postgresql version 11.8
Solution versions:
The only thing that helped after two hours was:
As explained in this post: ‘PostgreSQL Install fail on Windows 10 (icalcs error/acces denied)’ on the superuser forum of StackExchange:
- Uninstall en reinstall postgresql. The official version provided by EDB through this link: postgresql.org/download; Or try a different version if you are sure this one doesn’t work for you. Therefor head to the ‘File Browser’of Postgresql: here
- After reinstall, start pgAdmin from the Start Menu (scroll for the folder and the correct related pgAdmin; an older version could still hang around in the shortcuts and won’t start).
Note: You can keep your data map so nothing is lost!
In my case e.g.: I removed the /data folder from the (Windows 10) [Drive]/Program Files/PostgreSQL/11 and as soon as I uninstalled version 11.2 and reinstalled (earlier removed 12) version 12: when I started pgAdmin4 my former servers ([nameA] and [PostgreSQL 11] and databases ánd the new server [PostgreSQL 12] were there! And the connection was reestablished
Tried:
Earlier tried solutions that did not work in my case:
- Question 37307346 «Is the server running on host localhost 1 and accepting tcp ip connections on port 5432?
- Question 40532399 Unable to connect to server for postgres
- Question 16904997 Connection refused pgerror postgresql and rails
- Question 60532791 Timeout expired pgadmin unable to connect to server note: This was after semi solution of netstat running postgres service (port was not used before that solution; here listed as 4th item, item above).
answered Jun 17, 2020 at 22:47
If you have issues with permissions either after installations or after reinstalling postgres you might find help here.
Make sure you install the correct version for the data folder you have, you can check the version in that data folder under file named PG_VERSION.
- Install postgres with random data directory. If it doesn’t work with old data directory and you get errors about permissions or stuff like icacls then pick a fresh folder and proceed with this post.
- Go to registry editor and then find something like
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\postgresql-x64-11
<- version you installed
change imagepath to reflect the data directory
"C:\Program Files\PostgreSQL\11\bin\pg_ctl.exe" runservice -N "postgresql-x64-11" -D "{DATA_DIRECTORY like d:/db}" -w
- At this point the service might not even start, but check just in case it is magically working at this stage. It won’t log anything or throw any errors so don’t worry, if you do everything right it will work.
- Right click the data folder then go to Properites -> Security tab -> Advanced button
- Toggle the checkbox on the bottom «Replace all child object perm[..]»
- Press Add, and
select principal
on top, then type in the big boxNETWORK SERVICE
To make sure it works try pressing check names, it should underscore it. Then press OK, set all permissions to it. Then OK, OK, OK. You should leave the file properties approving everything.
If steps 4-6 throw out permissions errors read step 7 /
- Try running postgres. If for some reason you cant run postgres at this point. Then run command-line as an administrator, and type in
icacls "{DATA_FOLDER}" /reset /T
this will clear all the permissions that are there no matter what they are. Postgres install ought to be doing that but it’s bugged in some versions. As it was in mine. - Now you can try running postgres service.
- At this point PG Admin didn’t really work but I managed to login using the psql.exe and I’ve dumped all the data.
pg_dump -U {USERNAME} {DATABASE} > {FILENAME.EXT}
Then I’ve uninstalled postgres, restarted PC, then installed the newest version and I’ve recovered the dump.
answered Dec 22, 2020 at 17:10
Had the same problem, but I’m not comfortable downloading installers from unknown sources.
After quite some struggling (including run as different user, install from a session opned with a domain administrator account), the only thing that worked for me was to enable the local administrator command (net user administrator /active:yes), providing a password for it (net user administrator *) and then running the installer.
Hope this helps.
answered Sep 10, 2019 at 13:47
For me, problem was that some files inside Data folder of existing Postgres installation had cleared permissions & ownership information. I was able o fix the problem by going one level up above Data directory and re-setting the Owner of the child directories & files via standard Windows dialog. After that, re-running installer allowed icacls to set permissions & finish the installatio nsuccesfully.
answered Mar 19, 2020 at 5:50
Apparently this happens if you uninstall PostgreSQL and do not delete the «data» directory where your databases are stored. When you attempt to (re)install PostgreSQL, it fails to change permissions on that directory, because it already exists. I was able to work around this apparent bug in the installer by deleting all of C:\Program Files\PostgreSQL manually. But that might not be an option if you have data in there that you haven’t backed up.
answered Mar 27, 2020 at 18:02
We had the same Problem today while upgrading from 12.1 to 12.3.
Installer (EnterpriseDB) stopped with the error while icacls — call because of missing rights…
We even ran it as local administrator.
After stopping the setup the pg — service was removed and rights in pg-data / base — folder were missing.
We run takeown /F d:\PgData12\* /R /A
and startet the setup again. Then it worked without other problems.
answered Jun 11, 2020 at 6:05
My solution was log in with the user caller admnistrator, can’t be other user with permissions, must be the user administrator
answered Jan 18, 2021 at 15:15
I suspect a problem with user rights.
I was able to activate the Administrator account and perform the installation.
-
cmd (Run as Administrator)
-
net user administrator active: yes
-
logout old Account and login Administrator
-
install PostgreSQL
answered Mar 14, 2021 at 9:23
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
If you are having trouble installing PostgreSQL on Windows 10, here are a few steps that may help:
1. Check to make sure that your computer meets the minimum system requirements for PostgreSQL.
2. Download the PostgreSQL installer from the PostgreSQL website.
3. Run the installer and follow the prompts.
4. If you run into any errors during the installation process, try looking for a solution in the PostgreSQL documentation or online.
5. Once PostgreSQL is installed, you can start using it by creating a database.
Why PostgreSQL is not installing?
Installing PostgreSQL on Windows 10 is a fairly simple process. You can either install it using the Windows installer, or you can use the more traditional method of installing it from source.
If you want to install PostgreSQL from source, you will first need to download the source code. You can do this from the PostgreSQL website (https://www.postgresql.org/download/). Once you have downloaded the source code, you will need to unzip it and navigate to the unzipped folder. From here, you will need to run the following commands:
./configure
make
make install
This will install PostgreSQL on your system. Once it is installed, you will need to initialize the database by running the following command:
initdb -D /usr/local/pgsql/data
This will create the necessary files and folders for your database. Once the database is initialized, you can start it by running the following command:
pg_ctl -D /usr/local/pgsql/data -l logfile start
You can then connect to the database using a tool like psql or pgAdmin.
Does PostgreSQL work on Windows 10?
Yes, PostgreSQL works on Windows 10. You can install it using the Microsoft Windows Installer for PostgreSQL, available from the PostgreSQL website. Once installed, you can use the psql command-line tool to connect to your PostgreSQL database.
Is Stack Builder necessary for PostgreSQL?
No, Stack Builder is not necessary for PostgreSQL.
Can I use PostgreSQL without install?
No, you cannot use PostgreSQL without installing it.
How do I enable PostgreSQL on Windows?
1. Download and install PostgreSQL from https://www.postgresql.org/download/windows/.
2. Follow the instructions provided by the installer.
3. Once installation is complete, open the PostgreSQL command line client and connect to the database server.
4. Enable the PostgreSQL server to start automatically when Windows starts by opening the Services control panel and setting the «PostgreSQL Server» service to «Automatic«.
Is psql the same as PostgreSQL?
No, psql is a command-line interface for PostgreSQL.
Which tool is best for PostgreSQL?
There are many tools available for PostgreSQL, and the best one for you will depend on your specific needs and preferences. Some of the most popular tools include pgAdmin, phpPgAdmin, and PgBouncer. If you are looking for a tool with a graphical user interface (GUI), then pgAdmin or phpPgAdmin may be a good option for you. If you are looking for a tool to help manage database performance, then PgBouncer may be a good option for you.
How to setup PostgreSQL in Windows?
1. Go to the PostgreSQL website and download the installer for your version of Windows.
2. Run the installer and follow the prompts.
3. Once the installation is complete, open the PostgreSQL command line interface.
4. Type in the following command to create a new database:
createdb mydatabase
5. You can now connect to your database using a tool like pgAdmin or psql.
How to manually install PostgreSQL?
1. Download PostgreSQL from the official website (https://www.postgresql.org/).
2. Run the installer and follow the prompts.
3. Choose the location for the installation and select the components you want to install.
4. Click «Finish» to complete the installation.
If you have any problems during the installation, please consult the PostgreSQL documentation (https://www.postgresql.org/docs/).
How much RAM is needed for PostgreSQL?
There is no definitive answer to this question as it depends on a number of factors, such as the size of your database, the number of concurrent users, the nature of your workload, etc. However, a good rule of thumb is to start with at least 4GB of RAM and then scale up from there as needed.
How to install Postgres locally?
Assuming you are using a Mac, you can install Postgres locally using Homebrew.
1. Install Homebrew if you don’t already have it installed (https://brew.sh/).
2. Use Homebrew to install Postgres: `brew install postgresql`
3. Initialize the database: `initdb /usr/local/var/postgres`
4. Start the database server: `pg_ctl -D /usr/local/var/postgres -l logfile start`
For more detailed instructions, see the Postgres documentation: https://www.postgresql.org/docs/9.3/static/tutorial-install.html
Is Postgres available for Windows?
Yes, Postgres is available for Windows. You can download it from the Postgres website (https://www.postgresql.org/download/). Once you have downloaded and installed Postgres, you can use the psql command-line tool to connect to your Postgres database.
Did you install postgresql with administrator-privileges?
This might be due to a privilege-issue, you can try to:
-
Create a new user account, called postgres
-
Add the new account to the Administrators and Power Users groups
-
Restart the computer
-
Run a command prompt as the postgres user, using the command:
runas /user:postgres cmd.exe
-
Run the installer from the postgres command window
-
Delete the postgres user account, as well as the user directory
Another option is to:
-
Uninstall PostgreSQL
-
Delete the postgres user if it still exists.
net user postgres /delete
-
Create the postgres user with a password
net user /add postgres <password>
-
Add the postgres user to the Administrators group
net localgroup administrators postgres /add
5a. Add the postgres user to the Power Users group
net localgroup "power users" postgres /add
5b. Add the postgres user to the administrator’s local-group
net localgroup Administrators 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.6.12-windows.exe // or whatever version you are using
This should run the installation successfully.
-
Remove the postgres user from the Administrators group.
net localgroup administrators postgres /delete
as mentioned by @Imraan on DBA -> Link
Edit in regards to @Youssef’s comment:
Depending on the version and scenario, the user postgres
needs to be added to administrator’s localgroup
instead of power users
.
Short overview about power-users from superuser SE:
Note: in Windows 7 and above, Power Users only exists for legacy purposes, and is the same as ordinary Users, unless an admin explicitly adds extra rights to the group.
Power-users may:
-
Run legacy applications, in addition to Windows 2000 or Windows XP Professional certified applications.
-
Install programs that do not modify operating system files or install system services.
-
Customize systemwide resources including printers, date, time, power options, and other Control Panel resources.
-
Create and manage local user accounts and groups.
-
Stop and start system services which are not started by default.
-
Power Users do not have permission to add themselves to the Administrators group.
-
Power Users do not have access to the data of other users on an NTFS volume, unless those users grant them permission.
PostgreSQL — это мощная, бесплатная и открытая система управления базами данных. Но как и любое программное обеспечение, PostgreSQL может иметь проблемы при установке и настройке. Рассмотрим некоторые распространенные проблемы и возможные решения при установке PostgreSQL на операционную систему Windows 10 Pro.
Ошибка «The application was unable to start correctly (0xc000007b)»
Эта ошибка может возникать при попытке запустить PostgreSQL после его установки. Причиной может быть несовместимость версий библиотек. Чтобы решить эту проблему, можно попробовать установить все необходимые библиотеки вручную.
-
Скачайте необходимые библиотеки (например, Microsoft Visual C++ Redistributable for Visual Studio 2015) с официального сайта компании-разработчика.
-
Установите их на свой компьютер.
-
Перезапустите компьютер и попробуйте запустить PostgreSQL снова.
Ошибка «FATAL: role «postgres» does not exist»
Эта ошибка может возникнуть при попытке входа в PostgreSQL через командную строку. Она означает, что нет пользователя с именем «postgres». Чтобы решить эту проблему, нужно создать пользователя с этим именем.
-
Откройте командную строку от имени администратора.
-
Введите команду «psql -U postgres» и нажмите Enter. Эта команда запустит PostgreSQL и войдет в него от имени пользователя «postgres».
-
Введите команду «createuser -s -i -d -r -l -w postgres» и нажмите Enter. Она создаст нового пользователя с именем «postgres».
-
Попробуйте войти в PostgreSQL через командную строку снова.
Ошибка «Failed to load library ‘msvcr120.dll'»
Эта ошибка может возникнуть при попытке запустить PostgreSQL после его установки. Она означает, что отсутствует библиотека «msvcr120.dll». Чтобы решить эту проблему, нужно установить Microsoft Visual C++ Redistributable for Visual Studio 2013.
-
Скачайте Microsoft Visual C++ Redistributable for Visual Studio 2013 с официального сайта компании-разработчика.
-
Установите его на свой компьютер.
-
Перезапустите компьютер и попробуйте запустить PostgreSQL снова.
Ошибка «The database cluster initialisation failed»
Эта ошибка может возникнуть при попытке создания кластера баз данных PostgreSQL. Она означает, что процесс создания кластера не удался. Чтобы решить эту проблему, нужно проверить наличие необходимых файлов.
-
Откройте директорию, где установлен PostgreSQL (обычно это «C:\Program Files\PostgreSQL\XX», где XX — версия PostgreSQL).
-
Убедитесь, что в этой директории есть папка «data», в которой должны быть файлы «pg_hba.conf» и «postgresql.conf».
-
Если этих файлов нет, скопируйте их из директории «C:\Program Files\PostgreSQL\XX\share».
-
Попробуйте создать кластер баз данных снова.
Эти ошибки могут возникнуть при установке и настройке PostgreSQL на Windows 10 Pro. Но в большинстве случаев их можно решить с помощью простых действий, описанных выше. Если вы столкнулись с другими ошибками или проблемами, которые не описаны здесь, обратитесь за помощью к сообществу PostgreSQL или к его разработчикам.