Database Error

Fix "FATAL: password authentication failed for user 'postgres'"

Developer guide and instant terminal command to diagnose and solve this error.

Terminal Output
$FATAL: password authentication failed for user "postgres"

Why Does This Error Happen?

Incorrect password entered, or pg_hba.conf is enforcing md5/scram-sha-256 authentication for local sockets.

Instant Terminal One-Liner Fixes

Linux (Bash / Zsh)
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'new_password';"
macOS (Terminal / iTerm2)
psql postgres -c "ALTER USER postgres PASSWORD 'new_password';"
Windows (PowerShell Run as Administrator)
psql -U postgres -c "ALTER USER postgres PASSWORD 'new_password';"

Comprehensive Step-by-Step Resolution

  1. 1Reset password via postgres system user: "sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'newpass';"".
  2. 2Check pg_hba.conf host configurations.
  3. 3Restart PostgreSQL service.
Dedicated Companion Tool

Troubleshoot using the Port 5432 PostgreSQL Guide

Use our client-side utility with zero server upload for instant debugging.

Open Tool

Frequently Asked Questions

Frequently Asked Questions

Frequently Asked Questions

Everything you need to know regarding specifications, syntax, and security best practices.

Incorrect password entered, or pg_hba.conf is enforcing md5/scram-sha-256 authentication for local sockets.