Help restoring multiple Postgres databases to latest state after accidental volume swaps
ernestojaviern
PROOP

13 days ago

Hi, I need urgent help. While trying to recover my "web" service, I accidentally used "Swap Volume" on all my Postgres databases (Umayor, PRUEBA, Mitigo-master), leaving them pointing to wrong/empty volumes. I then ran several restores, and now "Umayor" won't stay online: it boots with data present ("PostgreSQL Database directory appears to contain a database; Skipping initialization") but crashes with password authentication failed for user "postgres" and data directory lock file is invalid / could not open postmaster.pid.

What I need: restore my databases (especially Umayor) to the most recent stable state you can recover — I don't need an exact date, just the latest consistent version available. PITR was OFF, and my most recent manual backup is 2026-06-22 20:24 (229 MB).

Please help me: (1) identify the volume/backup with my newest usable data, (2) reconnect it to the correct service, and (3) reset the postgres role password so the service stays online.

Project: 3c6d9775-574f-42db-bebb-6ea7caa50bfd

Services: Umayor, PRUEBA, Mitigo-master, web

Solved$20 Bounty

Pinned Solution

Try this to fix the auth errors:

  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

1 Replies

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


Try this to fix the auth errors:

  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

Status changed to Solved ernestojaviern 12 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...