Service is down
shaunmash
PROOP

13 days ago

Postgres password authentication is failing persistently.

The POSTGRES_PASSWORD variable doesn't match the password hash in the database volume.

Need: either a manual password reset on the database, or a backup restore.

Project: c91bef60-f02c-4b34-ab51-e22b44aa030d

Postgres service: d4b9cbc5-da57-4dcb-af56-6afd9610528d

Solved$20 Bounty

Pinned Solution

If that doesn't work, try changing the password manually:

  1. Click into your database service and go to the console tab
  2. Run this command: sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf (This will bypass user authentication)
  3. Redeploy your database
  4. Console again, and run the command psql
  5. Run ALTER USER postgres with password '<PASSWORD>'; where is the value of the variable PGPASSWORD in your Railway dashboard
  6. Type exit
  7. Run sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf (This will re-enable user authentication)
  8. Redeploy your database

4 Replies

Railway
BOT

13 days ago

Having looked into this, the issue appears to be in your application code or configuration rather than the Railway platform itself, which puts it outside what Railway support can resolve directly.

This is exactly the kind of problem the Railway community is good at, so we'd like to open your thread as a community bounty. Railway pays a bounty to the community member who solves it, and threads like this usually get picked up quickly.

Opening it makes this entire thread public, including everything already posted. Nothing becomes public until you decide. Use the buttons below.

  • Open to the community - Before you click, take a moment to edit or remove anything you'd rather not share. The thread becomes publicly visible right away.
  • Keep it private and close the thread - Nothing becomes public and the thread closes.

Status changed to Awaiting User Response Railway • 13 days ago


Railway
BOT

13 days ago

This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.

Status changed to Open Railway • 13 days ago


Have you tried regenerating the password from Database > Config > Connection > Regenerate password?


If that doesn't work, try changing the password manually:

  1. Click into your database service and go to the console tab
  2. Run this command: sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf (This will bypass user authentication)
  3. Redeploy your database
  4. Console again, and run the command psql
  5. Run ALTER USER postgres with password '<PASSWORD>'; where is the value of the variable PGPASSWORD in your Railway dashboard
  6. Type exit
  7. Run sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf (This will re-enable user authentication)
  8. Redeploy your database

shaunmash
PROOP

13 days ago

@darseen Thanks that got me back up and running :)


Status changed to Solved mayori • 13 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...