a month ago
I changed the MYSQL_ROOT_PASSWORD environment variable in my MySQL service but the database container is still using the old password. Now I cannot connect to the database at all.
Error: Access denied for user 'root'@'localhost' (using password: YES)
I tried connecting via the Railway console with the new password stored in $MYSQL_ROOT_PASSWORD but it says access denied. The MySQL process is already running with the old password stored in the volume (mysql-volume), so changing the env var alone didn't update it.
I need help resetting the MySQL root password without losing the existing data in the volume. I cannot drop the volume because it contains production data.
Project: sistema-financiera (production environment)
Service: MySQL
1 Replies
a month ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 30 days ago
a month ago
You can bypass authentication by starting your MySQL service with --skip-grant-tables, manually update the password via SQL, and then redeploy your service. Just change the start command to mysqld --skip-grant-tables --skip-networking (skip networking ensures the database isn't connected to the public network while you reset your password).