a month ago
Hi Railway team,
I manage a production MySQL service and I lost the root password after a failed password rotation. The database UI panel now shows “Access denied for user ‘root’@‘127.0.0.1’ (using password: YES)” and I can no longer connect to run any SQL.
Details:
• Account email: tons217@gmail.com
• Project: production
• Service: MySQLThe MYSQL_ROOT_PASSWORD variable no longer matches the actual root password inside the database, and redeploying the service did not re-sync it. All my data is still on the volume and I do NOT want to lose it — this is a production database with sensitive user data.
Could you please help me reset the MySQL root password WITHOUT wiping the volume / without data loss, or tell me the safe procedure to regain root access on this managed MySQL service?
Thank you.
1 Replies
a month ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • about 1 month ago
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 - Go to the console tab of your MySQL service
- In the terminal, 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