psql Installation

  1. Go to the official PostgreSQL download page → www.postgresql.org/download/windows/

  2. Click "Download the installer"

  3. Launch the downloaded .exe file

  4. Follow the installation steps:

  5. Add psql to PATH

    1. Go to Environment Variables

    2. Add this (default Path) or the path which you specified during installation

      C:\\Program Files\\PostgreSQL\\<version>\\bin
      
  6. Open Terminal and Test

    1. Check if pqsl installed properly

      psql --version
      
    2. Connect to PostgreSQL using psql

      It will prompt for the password (enter the one you set during installation).

      psql -U postgres
      
      • Output

Some psql Commands


Create DB

  1. Go to https://console.neon.tech & create a DB
  2. Get the connection
postgresql://your username:your password@ep-empty-hat-a178qeav-pooler.ap-southeast-1.aws.neon.tech/neondb?sslmode=require

Connecting Remote Neon DB to psql

  1. Connection String with Parameters

    Use this format when you want full control using named parameters:

    psql "host=ep-empty-hat-a178qeav-pooler.ap-southeast-1.aws.neon.tech dbname=neondb user=neondb_owner password=<your_password> sslmode=require"
    

    Replace <your_password> with your actual password.

    • host=... Your Neon cluster endpoint
    • dbname=neondb The name of your Neon database
    • user=neondb_owner Your Neon database user
    • password=... The password from your connection string
    • sslmode=require Neon requires SSL for connections