PostgreSQL error: password authentication failed for user

PostgreSQL·Sep 12, 2026·beginner·
Quick answer

The username/password in your connection string doesn't match what the database expects. Regenerate or re-copy the full connection string from your provider's dashboard (Neon, Supabase, etc.) rather than typing it by hand.

What causes this error

PostgreSQL rejects the connection at the authentication step — meaning the network connection itself succeeded, but the username/password pair is wrong. This is distinct from a 'can't reach server' error, which fails earlier.

The Fix

  1. Go to your database provider's dashboard and copy the connection string fresh — don't retype it manually, special characters in passwords are easy to mistype
  2. If your password contains special characters like @ or #, make sure they're URL-encoded in the connection string
  3. Confirm you're using the correct role/user — some providers create a separate read-only user by default

Common causes / variations

  • Password rotated/reset in the dashboard but `.env` not updated
  • Unescaped special characters in the password breaking the URL format
  • Using a production connection string in a local `.env` that has different credentials

Related errors

See also: PrismaClientInitializationError, too many connections error.

Was this fix helpful?

Comments

Loading comments...

Fix: PostgreSQL password authentication failed for user | BugFixer | BugFixer