How to Install PostgreSQL on Windows
Perform the following steps to install the PostgreSQL database server on Windows 10/Server.
Open a web browser and point it to www.enterprisedb.com/downloads/postgres-postgresql-downloads and download the PostgreSQL version you want to install.
After downloading PostgreSQL, double-click and run the installer, and it will guide you through the installation process.
Accept the default installation directory and click Next (The Postgres installation directory is where all the executable and configuration files are stored in Windows).
Select the Components you want to install (PostgreSQL Server, pgAdmin 4, Stack Builder, and Command Line Tools).
Click Next and proceed with the default Data Directory. This is the location where PostgreSQL stores your data (databases).
Configure a password for the user postgres. As a database administrator, you will use this user account to administrate the Postgres server on Windows.
The Postgres port number should be 5432 (do not change the default port unless you have a good reason).
In the following window, select the Locale (Language) to be used by PostgreSQL Server.
After the Postgres installation has concluded, click the finish button to exit the setup (Deselect the Stack Builder, no deed to run it).
PostgreSQL on Windows is installed as a service. To access Postgres service, go to Start | Windows Administrative Tools | Services.
You can use service windows to start, stop and restart PostgreSQL Server.
postgresql.conf is the main configuration file of the database cluster. It is located in the data directory. For example, if you installed PostgreSQL 13, the full path will be
Inside the data directory, the
base subdirectory contains all databases and tables.
Connecting to the PostgreSQL Server
PostgreSQL ships with psql, a command-line client that we use to connect and administer databases and the cluster itself.
You will find a shortcut to open
psql (SQL Shell) under the start menu, as shown in the previous screenshot.
The default username is
postgres, the password is the password you created during the installation.