Thanks for visiting my GitHub account!
This guide provides step-by-step instructions to install PostgreSQL on a Windows system, including optional setup for development with Node.js, Prisma, and Next.js.
-
Visit the official PostgreSQL download page:
👉 https://www.postgresql.org/download/windows/ -
Click on "Download the installer" by EDB.
-
Download the latest version suitable for your system.
- Run the downloaded
.exe
file. - Click Next through the setup screens.
- Leave the default components selected:
- PostgreSQL Server
- pgAdmin
- Stack Builder (optional)
- Choose the installation directory or leave it default.
- Set a strong password for the default PostgreSQL user:
postgres
. - IMPORTANT: Save this password securely. You'll need it to access the database.
- Default is
5432
. You can leave it as is unless you're running multiple databases.
- Leave the locale to default or set according to your region.
- Click Next and then Install.
- Wait until installation is complete.
-
Navigate to:
C:\Program Files\PostgreSQL\<version>\bin
-
Copy the path.
-
Add it to your Windows Environment Variables:
- Open Start → type "Environment Variables"
- Click Environment Variables...
- Under System variables, find
Path
→ Click Edit → New - Paste the path, then click OK
-
Open Command Prompt and run:
psql -U postgres
-
Enter the password you set earlier.
-
If successful, you’ll see:
postgres=#
-
Exit by typing:
\q
If you see this warning:
WARNING: Console code page (850) differs from Windows code page (1252)
Run this before psql
:
chcp 1252
After installation, you may run Stack Builder to install:
- PostGIS: For geospatial support
- pgAdmin plugins: For extended GUI features
- pgAgent: For scheduling jobs
- ODBC/JDBC Drivers: For external application connectivity
⚠️ You don’t need Stack Builder for standard web development with PostgreSQL and Node.js.
Install Prisma:
npm install prisma @prisma/client
npx prisma init
Set your .env
:
DATABASE_URL="postgresql://postgres:<your-password>@localhost:5432/<your-db-name>"
Migrate your schema:
npx prisma migrate dev --name init
npx prisma generate
PostgreSQL is now installed and ready to use for local development.
- Official docs: https://www.postgresql.org/docs/
- Prisma: https://www.prisma.io/docs
- Next.js: https://nextjs.org/docs