New credentials don't update after redeploy
marcelocch
PROOP

4 months ago

Problem description: We used a password regeneration tool for the root user of our database. However, after the process was completed, Railway redeployed the database, but the new password was not applied correctly; the connection still works only with the old password.

Expected behavior: The newly generated password should be applied correctly, and the old password should no longer be valid.

Current behavior: The database was redeployed, but it continues to use the old password.

$20 Bounty

2 Replies

Railway
BOT

4 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


4 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open noahd 4 months ago


4 months ago

Hi, here's the guide I always give.

Before you do any of this, disable all public access domains. Just in case.

  1. Install the Railway CLI. You can do so here: https://docs.railway.com/guides/cli

  2. Copy the SSH command by right clicking the PostgreSQL service

  3. Once you're in, type in the following command: (Copy paste this EXACTLY as written.)

    sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf

  4. Redeploy your database.

  5. Use the SSH command again, and once you're in, type psql.

  6. Type the following SQL command. my_password should be replaced with whatever it actually says in your variables tab for your password (Probably under the PGPASSWORD variable.)

    ALTER USER postgres with password 'my_password';

  7. Type exit

  8. Reset your authentication settings with the following command:

    sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf

  9. Redeploy your database once again. You have now changed the password.

Let me know if this works!


Loading...