PostgreSQL error: password authentication failed for user
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
- 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
- If your password contains special characters like
@or#, make sure they're URL-encoded in the connection string - 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...