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
Pinned Solution
13 days ago
If that doesn't work, try changing the password manually:
- Click into your database service and go to the console tab
- 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) - Redeploy your database
- Console again, and run the command
psql - Run
ALTER USER postgres with password '<PASSWORD>';where is the value of the variablePGPASSWORDin your Railway dashboard - Type exit
- 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) - Redeploy your database
4 Replies
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
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
13 days ago
Have you tried regenerating the password from Database > Config > Connection > Regenerate password?
13 days ago
If that doesn't work, try changing the password manually:
- Click into your database service and go to the console tab
- 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) - Redeploy your database
- Console again, and run the command
psql - Run
ALTER USER postgres with password '<PASSWORD>';where is the value of the variablePGPASSWORDin your Railway dashboard - Type exit
- 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) - Redeploy your database
13 days ago
@darseen Thanks that got me back up and running :)
Status changed to Solved mayori • 13 days ago
