a month ago
Severity: P0 production - app serving via stale container (17h+ deployment), all new deploys failing healthcheck.
Project: just-mindfulness
Project UUID: 70f5b6bd-fe02-46fa-9943-5b413be37c65
Service affected: MySQL
Service affected: ehts-predict (in observant-simplicity project, references MySQL via DATABASE_URL)
Issue:
At 07:31 BRT today (2026-05-19) I rotated MYSQL_ROOT_PASSWORD via Railway dashboard Variables tab. The variable updated successfully, but the MySQL container did not restart, leaving the grant tables with the OLD password while the env var has the NEW password.
Now all root authentication fails:
-
Railway Database UI (Database tab on MySQL service):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) -
External connections via shinkansen.proxy.rlwy.net:52166 from TablePlus:
Access denied for user 'root'@'100.64.0.26' (using password: YES) -
New deployments of ehts-predict app fail healthcheck because new containers cannot authenticate to MySQL. Deploy logs show:
iniciando migrations
Failed query: create table if not exists __drizzle_migrations (...)
ELIFECYCLE Command failed with exit code 1
Current state:
- App prod container from 17h ago still serving (cached connection pool pre-rotation)
- ~30 failed deploys today since rotation
- No customer-facing outage YET but high risk if current container restarts
Customers in production using this service: UNIMED Porto Alegre, Centauro/SBF, IMC Pimenta Verde Alimentos, PagBank pipeline.
What I've tried:
- Verified MYSQL_ROOT_PASSWORD env var value is correctly set (32 alphanumeric chars, no special chars or whitespace)
- Verified DATABASE_URL on ehts-predict service uses correct host (shinkansen.proxy.rlwy.net:52166)
- Tried backup before any fix attempt → "Backups using 50% volume limit" error, cannot create new backup
What I need:
A safe way to either:
(a) Restart MySQL service in a way that re-runs the Docker entrypoint to update mysql.user grant tables from the current MYSQL_ROOT_PASSWORD env var, OR
(b) Direct mysql.user grant table update by Railway team via server-level access
I'm reluctant to manually restart MySQL without confirmation that the Railway MySQL template entrypoint will re-apply the env var to grant tables on restart (vs only on initial container creation).
Timeline pressure: Pitch meeting Centauro/SBF scheduled 30/05 requires recent D2 code in production. Pre-vacation Fabio 01-11/06 requires production stability handoff.
Available for screen-share or any verification needed. Pro plan user, ffloh1818.
Thank you.
Pinned Solution
a month ago
Unfortunately this isn't a platform level issue, so a Team member will not be assigned to this issue. Just to be safe, however, you can trigger a manual backup by going into the Backups tab in your service settings.
- And
--skip-grant-tablesbypasses MySQL authentication (You currently can't log in as you have lost the original password). FLUSH PRIVILEGEScan be ran after bothALTERcommands are executed.- You'll need to manually redeploy after changing the Custom Start Command.
- I'd say a few minutes on average if you're familiar with the terminal; I'd recommend preparing the list of commands that need to be copied and pasted beforehand to increase efficiency.
- IIRC no, but you can enable Teardown and set the draining time to ~10s to give time for the database to gracefully shut down.
I'd also make sure any services that are reading/writing to the db is temporarily paused to prevent data loss.
5 Replies
Status changed to Open Railway • about 1 month ago
a month ago
Revert the change in variable. You should only be rotating credentials via the Database > Config tab, not manually with variables.
0x5b62656e5d
Revert the change in variable. You should only be rotating credentials via the Database > Config tab, not manually with variables.
a month ago
Thanks for the quick response, much appreciated.
Unfortunately I don't have the old password anymore — I overwrote it in my password manager when I rotated to the new one (the rotation was done because the old password had been accidentally exposed in a chat log earlier today).
Given this constraint, I have two questions:
-
Is there a way to update mysql.user grant tables server-side to match the current MYSQL_ROOT_PASSWORD env var? (e.g. via Railway internal admin access)
-
Alternatively, would restarting the MySQL service container cause the Docker entrypoint to re-apply MYSQL_ROOT_PASSWORD to the grant tables? If yes, this would be the safer path. If not, I'd need server-side intervention.
For context: production app is currently serving via stale container with cached connection (deploy from 17h ago). No customer outage yet, but ~30 failed deploys accumulated today.
Also noted for the future: I'll use Database > Config tab for credential rotation going forward. Apologies for the manual Variables approach.
Thank you again.
a month ago
Try this:
- Remember the current Custom Start Command
- Change the Custom Start Command to
docker-entrypoint.sh mysqld --skip-grant-tables --skip-networkingand redeploy - SSH into your MySQL service (Right click the service and Copy SSH Command) (You'll need Railway CLI installed for this to work)
- In the terminal, paste the SSH command and run
mysql -u root - Run the following commands:
ALTER USER 'root'@'localhost' IDENTIFIED BY '<PASSWD>';
ALTER USER 'root'@'%' IDENTIFIED BY '<PASSWD>';
FLUSH PRIVILEGES;Where <PASSWD> is replaced with the new password (From the variable MYSQL_ROOT_PASSWORD)
- Revert the custom start command and redeploy MySQL
- Make sure to restart other services that depend on your MySQL database
0x5b62656e5d
Try this: 1. Remember the current Custom Start Command 2. Change the Custom Start Command to `docker-entrypoint.sh mysqld --skip-grant-tables --skip-networking` and redeploy 3. SSH into your MySQL service (Right click the service and Copy SSH Command) (You'll need Railway CLI installed for this to work) 4. In the terminal, paste the SSH command and run `mysql -u root` 5. Run the following commands: ```sql ALTER USER 'root'@'localhost' IDENTIFIED BY '<PASSWD>'; ALTER USER 'root'@'%' IDENTIFIED BY '<PASSWD>'; FLUSH PRIVILEGES; ``` Where `<PASSWD>` is replaced with the new password (From the variable `MYSQL_ROOT_PASSWORD`) 6. Revert the custom start command and redeploy MySQL 7. Make sure to restart other services that depend on your MySQL database
a month ago
Thank you for the detailed steps — I appreciate the thoroughness.
Given this involves production downtime, SSH operations I haven't performed on Railway before, and the risk of further corrupting grant tables if executed incorrectly, would it be possible for a Railway engineer to execute these steps on my behalf via internal access?
Production customers depending on this service: UNIMED Porto Alegre (9-year client), Centauro/SBF, IMC Pimenta Verde Alimentos, plus PagBank pipeline negotiation.
If self-service is the only option available, I'll proceed carefully but would appreciate confirmation on these specifics before I start:
-
With
--skip-grant-tablesenabled, doesmysql -u root -pstill prompt for a password, or is authentication bypassed entirely (just press Enter)? -
Are the three ALTER USER statements sufficient on their own, or should I include
FLUSH PRIVILEGES;as a separate fourth command after them? -
When I revert the Custom Start Command back to the original value, will Railway auto-deploy the change, or do I need to manually trigger a redeploy?
-
What is the expected downtime window for services with active connections to this MySQL during the procedure (steps 2-6)?
-
Are there any state-preserving steps I should take before changing the Custom Start Command (e.g. ensuring InnoDB buffer flush)?
Happy to do this during a coordinated maintenance window if Railway team prefers a scheduled async approach. Available all afternoon BRT today, or any time the team prefers.
Thanks again.
a month ago
Unfortunately this isn't a platform level issue, so a Team member will not be assigned to this issue. Just to be safe, however, you can trigger a manual backup by going into the Backups tab in your service settings.
- And
--skip-grant-tablesbypasses MySQL authentication (You currently can't log in as you have lost the original password). FLUSH PRIVILEGEScan be ran after bothALTERcommands are executed.- You'll need to manually redeploy after changing the Custom Start Command.
- I'd say a few minutes on average if you're familiar with the terminal; I'd recommend preparing the list of commands that need to be copied and pasted beforehand to increase efficiency.
- IIRC no, but you can enable Teardown and set the draining time to ~10s to give time for the database to gracefully shut down.
I'd also make sure any services that are reading/writing to the db is temporarily paused to prevent data loss.
Status changed to Solved brody • about 1 month ago