-
Download PostgreSQL:
- Visit: https://www.postgresql.org/download/windows/
- Download PostgreSQL 16.x installer
- Run as Administrator
-
Installation Settings:
- Port:
5432(default) - Superuser password: Choose a strong password
- Install pgAdmin 4 (recommended)
- Default locale settings
- Port:
-
Verify Installation:
psql --version
After PostgreSQL is installed, run these commands:
# Connect to PostgreSQL (will prompt for password)
psql -U postgres
# Create the database
CREATE DATABASE mealmate;
# Connect to the new database
\c mealmate
# Verify connection
\dtYour .env file should have:
DATABASE_URL="postgresql://postgres:your_password@localhost:5432/mealmate"Replace your_password with the password you set during installation.
Once database is created, run:
npm run db:pushThis will create all tables from your schema automatically.
- Connection refused: Make sure PostgreSQL service is running
- Authentication failed: Check username/password in DATABASE_URL
- Database doesn't exist: Run
CREATE DATABASE mealmate;in psql - Permission denied: Make sure user has database creation privileges