How can I install PostgreSQL using the command prompt?

16,392

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.

Share:
16,392

Related videos on Youtube

BeneGIS
Author by

BeneGIS

I am studying Geography Bsc at the University of Bonn, Germany. I have basic knowledge in QGIS, ArcGIS, R, PHP and SQL among others.

Updated on September 18, 2022

Comments

  • BeneGIS
    BeneGIS over 1 year

    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?

    • Seth
      Seth over 7 years
      Did you actually get the error message described in that tutorial or did you just get "an error"?
    • BeneGIS
      BeneGIS over 7 years
      I did get the first error message "Failed to load sql modules into the database cluster". I'm not sure about the second message anymore.
  • BeneGIS
    BeneGIS over 7 years
    Thank you. Unfortunately it still doesn't work. I get the same error. Before the installation it said that i still have "PostgreSQL" on my C:-folder, and that it will overwrite this "PostgreSL"-folder. However I can't find any PostgreSQL-folder on C:, as i deleted them all. Very strange.
  • Seth
    Seth over 7 years
    Maybe take a snap of the actual message during installation? That could be valuable information. If it tells you about that folder it has to be somewhere. The default Path would be C:\Program Files\PostgreSQL\9.6. Did you customize the paths to the installation folder or data folder? Did you consider trying to install it to a folder that is not C:\Program FIles and give it a shot?