2 months ago
Hello Railway Support Team, I am writing to report a critical authentication issue with my PostgreSQL database service in the project daring-contentment. I am consistently receiving a FATAL: password authentication failed for user "postgres" error and I am unable to connect. After extensive troubleshooting, I have confirmed that the credentials displayed in the 'Variables' tab of my Railway dashboard are out of sync with the actual credentials the database server is accepting. Here are the steps I have already taken to prove this is a platform-side issue: - I confirmed the usernamepostgres) and database name railway) are correct by revealing them in the project's dashboard. - I attempted to connect using two independent clients (DBeaver and the native psql command-line tool) through the railway connect tunnel. - Both clients fail with the exact same password authentication error. - I have tried to "Redeploy" the service multiple times to trigger a credential rotation. However, the password shown in the PGPASSWORD variable does not change, and the authentication error persists. This indicates an internal state mismatch on the Railway platform that automated recovery methods are not fixing. Could you please manually force a credential rotation or reset for this PostgreSQL service? Thank you for your help. Best regards.
4 Replies
2 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!
2 months ago
Hello,
The databases are entirely unmanaged, password resynchronization can only happen due to the results of a user's action.
Unfortunately, we do not offer password recovery services, so I will open this up to the community so they can help you recover your password.
Best
Brody
Status changed to Awaiting User Response Railway • 2 months ago
2 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 brody • 2 months ago
2 months ago
Hello. This is a fun process. 
⠀
Before you do any of this, disable all public access domains. Just in case.
⠀
Install the Railway CLI. You can do so here: https://docs.railway.com/guides/cli
Copy the SSH command by right clicking the PostgreSQL service
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.confRedeploy your database.
Use the SSH command again, and once you're in, type
psql.Type the following SQL command.
my_passwordshould be replaced with whatever it actually says in your variables tab for your password (Probably under thePGPASSWORDvariable.)ALTER USER postgres with password 'my_password';Type
exitReset 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.confRedeploy your database once again. You have now changed the password.
⠀
Let me know if this works!
2 months ago
OMG, I tried in my case and it worked like a charm. Thank a lot for the hints! You are the best! My database is back.
Status changed to Solved noahd • 2 months ago

