Windows – How to install PostgreSQL using the command prompt

installationpostgresqlwindows 10

I have problems with installing PostgreSQL. I tried to download PostgreSQL Version 9.6.1 for Windows x86-64 from enterprisedb.com.

I have the widespread problem, that the prompt "Failed to load sql modules into the database cluster" shows up, when I try to install PostgreSQL.

So I googled my problem and I found a tutorial here http://www.postgresqltutorial.com/install-postgresql/ which should solve my problem.

It says:

You need to do the following steps:

  1. Uninstall the PostgreSQL and delete the data directory in the installation folder
  2. Create a new Windows user named postgres and add it to the Administrators group
  3. Restart your computer
  4. Open cmd (command prompt)
    as the postgres command using the following command: runas
    /user:postgres cmd.exe
  5. A new window appears, you need to run the
    installer file from this window.

I did steps 1 – 3. Then I opened the command prompt and typed "runas /user:postgres cmd.exe" Then this Window appeared:

Click here to view the image

And now I don't have a clue, what to type in there in order to run the postgreSQL installer. I have no experience with command prompts. Can somebody please help me with this?

Best Answer

You change the directory (cd) to the one where you downloaded the PostgreSQL installer to and just type in the name of the executable and hit enter.

As an example:

cd C:\Users\<User>\Download\
PostgreSQL-Installer.exe

Or just use the whole path (be careful with spaces):

C:\Users\<User>\Download\PostgreSQL-Installer.exe

Another option would've been to rightclick while holding Shift and selecting "Run as different User" or "Run as administrator". Both methods might not working depending on whenver administrative priviliges or a separate user account are actually needed.

Related Question