a month ago
I regenerated password on my MySQL database. Then, after updating the database url env variable on my backend service with the new password, subsequent deployments are crashing with error:
Error: P1000: Authentication failed against database server, the provided database credentials for root are not valid.
4 Replies
a month 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!
a month ago
Time for the great guide of all time
⠀
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!
samgordon
Time for the great guide of all time⠀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/cliCopy the SSH command by right clicking the PostgreSQL serviceOnce 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_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';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!
a month ago
do you have handy a flavor of this guide for MySQL instead of Postgre?
a month ago
deleting database and creating a new one solved it. Apparently the way MySQL is containerized, password regeneration doesn't propagate
Status changed to Solved noahd • about 1 month ago