Error: Existing volume and new service
mang0tang0
HOBBYOP

a month ago

I mounted an existing Postgres volume to a new service. The data is intact, but I get „password authentication failed for user postgres". Please reset the stored database password to match the new service's PGPASSWORD. Nothing has been overwritten.

$10 Bounty

1 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 1 month ago


Try this:

  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. SSH again, and run the command psql
  5. Run ALTER USER postgres with password '<PASSWORD>'; where <PASSWORD> 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

Welcome!

Sign in to your Railway account to join the conversation.

Loading...