Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues while installing PostgreSQL in Windows 10

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'.

like image 333
PGreen_xyz Avatar asked Jan 26 '23 13:01

PGreen_xyz


1 Answers

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:

  1. Uninstall PostgreSQL

  2. Delete the postgres user if it still exists.

     net user postgres /delete
    
  3. Create the postgres user with a password

     net user /add postgres <password>
    
  4. 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
  1. Run a command window as the postgres user

     runas /user:postgres cmd.exe
    
  2. 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.

  3. 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.

like image 61
iLuvLogix Avatar answered Feb 16 '23 15:02

iLuvLogix