Install PostgreSQL on Windows

Summary: In this tutorial, you will learn step by step how to install PostgreSQL on your local system.

Install PostgreSQL on macOS Install PostgreSQL

  • on Linux PostgreSQL

was

developed for UNIX-like platforms, however, it was designed to be portable. This means that PostgreSQL can also run on other platforms such as macOS, Solaris, and Windows.

Since version 8.0, PostgreSQL offers an installer for Windows systems that makes the installation process easier and faster. For development purposes, we will install PostgreSQL version 12 on Windows 10.

There are three steps to complete the PostgreSQL installation:Download PostgreSQL installer for Windows Install PostgreSQL Verify installation

1) Download PostgreSQL Installer for Windows

First, you need to go to the download page of

  1. the PostgreSQL
  2. installers

in EnterpriseDB.

Secondly, click the download link as shown below:

Download PostgreSQL

It will take a few minutes to complete the download

. 2) Install PostgreSQL on Windows step

by step To install PostgreSQL on Windows, you must have administrator privileges.

Step 1. Double click on the installer file, an installation wizard will appear guiding you through multiple steps where you can choose different options you would like to have in PostgreSQL.

Step 2. Click the Next

Install PostgreSQL 12 Windows Step 1

Step 3. Specify the installation folder, choose your own, or keep the default folder suggested by the PostgreSQL installer and click the Next

  • Install PostgreSQL 12 Windows Step 2

Step 4. Select the software components you want

to install:The PostgreSQL server to install the PostgreSQL database server

  • pgAdmin 4 to install the PostgreSQL database GUI administration tool.
  • Command-line tools

  • for installing command-line tools such as psql, pg_restore, etc. These tools allow you to interact with the PostgreSQL database server using the command line interface.
  • Stack Builder provides a GUI that allows you to download and install drivers that work with PostgreSQL.

For the tutorial on this website, you don’t need to install Stack Builder, so feel free to uncheck it and click the Next button to select the data directory:

Install PostgreSQL 12 Windows Step 3

Step 5. Select the database directory to store the data or accept the default folder. And click the Next button to go to the next step:

Install PostgreSQL 12 Windows Step 4

Step 6. Type the password for the database superuser (

postgres)

PostgreSQL runs as a background service under a service account named postgres. If you have already created a service account with the name postgres, you must provide the password for that account in the next window.

After entering the password, you need to retype it to confirm and click the Next button:

Install PostgreSQL 12 Windows Step 5

Step 7. Enter a port number on which the PostgreSQL database server will listen. The default PostgreSQL port is 5432. You must ensure that no other applications are using this port.

Install PostgreSQL 12 Windows Step 6

Step 8. Choose the default locale used by the PostgreSQL database. If you leave it as the default locale, PostgreSQL uses the locale of the operating system. After that, click on the Next button.

Install PostgreSQL 12 Windows Step 7

Step 9. The configuration wizard will display PostgreSQL summary information. You should review it and click on the Next button if everything is correct. Otherwise, you should click the Back button to change the settings accordingly.

Install PostgreSQL 12 Windows Step 8

Now, you are ready to install PostgreSQL on your computer. Click the Next button to begin installing PostgreSQL.

Install PostgreSQL 12 Windows Step 9

The installation may take a few minutes to complete

.

<img src

=”https://www.postgresqltutorial.com/wp-content/uploads/2020/07/Install-PostgreSQL-12-Windows-Step-10.png”

alt=”” />

Step 10. Click the Finish button to complete the PostgreSQL installation.

Install PostgreSQL 12 Windows Step 11

3) Verify

the installation

There are several ways to verify your PostgreSQL installation. You can try to connect to the PostgreSQL database server from any client application, for example, psql and pgAdmin.

The fastest way to verify the installation is through the psql program.

First, click on the psql application to launch it. The psql command-line program is displayed.

Install PostgreSQL psql

Secondly, enter all the necessary information such as server, database, port, username and password. To accept the default, you can press Enter. Note that you must provide the password you entered during PostgreSQL installation.

Code language: Shell Session (shell)

Third, run the SELECT version() command; you will see the following output:

Install PostgreSQL psql verification

Congratulations! you have successfully installed the PostgreSQL database server on your local system. Let’s learn several ways to connect to the PostgreSQL database server.

Contact US