When I tried to install PostgreSQL on Windows 10 (64-bit), I was getting a prompt saying:
'Failed to load SQL modules into the database cluster'
and
'problem running post-install setup'.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With