Skip to content
Rotate DB Password
andremaytorena
OP

25 days ago

Hi guys, I need to rotate my postgres passwords after the leak, however these are pgvector instances and not the regular postgres database, any advice on how to rotate the password and make sure the variables are updated too without issues? I have like 10 dbs to update.

Screenshot 2026-10-26 at 16.09.27.png

Solved

1 Reply

Railway
BOT

25 days ago

These pgvector databases run from the pgvector/pgvector:pg16 image, and they don't have the database Config tab where the one-click Regenerate password option lives. That means you change the password by hand, and both sides have to change together.

A Postgres database stores its password in its data directory. It only reads the password variable the first time it initializes an empty volume, so editing POSTGRES_PASSWORD alone doesn't change the real password. Running ALTER USER alone doesn't update the variables either. If you do only one, every connection fails with an authentication error.

For each database, first run ALTER USER <your user> WITH PASSWORD '<new password>'; against it. Then, in the service's Variables, set POSTGRES_PASSWORD and PGPASSWORD to that same value. Also check that DATABASE_URL, DATABASE_PUBLIC_URL and any custom connection strings, like PREPS_DSN, reference those variables rather than holding the old password as plain text. Finally, redeploy every service that uses these credentials so it picks up the new password. Until then, those services keep failing to connect.

If a database and its variables get out of sync, set the variable back to the password the database actually holds and redeploy. That puts them back in sync. More on how database passwords work.


Status changed to Awaiting User Response Railway • 25 days ago


Railway
BOT

18 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 18 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...