mySQL database online BUT i cannot connect from console or server
baraa4b
PROOP

6 days ago

i have mySQL service connected to this volume and the service is online and everything, BUT I CANNOT ACCESS TO THE VOLUME AND DATA FROM THE CONSOLE AND IT KEEPS SAYING CONNECTION LOST AND REGARDLESS OF HOW MUCH I WAIT, RETRY OR REDEPLOY, CHANGING VERSION ETC.. NOTHING WORKED, please i need it working as fast as possible, u can edit and get access to do whatever, but make it work, (and my backend is crashed because of connection failing to the database)

Solved$20 Bounty

Pinned Solution

baraa4b
PROOP

6 days ago

Apparently it was a misconfiguration from the inside of the database, I have altered the password in the console to the current password (they were supposed to be the same anyway but I have no idea how it got changed, regarding the fact that I did multiple reconfiguration with service-volume to align the configurations).

Briefly: it was a password mismatch, but next level.

Here is what I did to resolve it, in mySQL service, the console tab:

  1. first I added those flags to the custom start command on the service itself, to access the db without the password:

"mysqld --skip-grant-tables --skip-networking"

  1. then I ran this "mysql --socket=/var/run/mysqld/mysqld.sock -u root"

to access the database.

  1. after that I got into the db I ran this query:

"""

FLUSH PRIVILEGES;

ALTER USER 'root'@'%' IDENTIFIED BY 'TheSamePasswordThatWasInTheSerivceEnv';

FLUSH PRIVILEGES;

EXIT;

"""

  1. then I removed the flags I added in step 1, redeployed, and boom, everything was fine again.

thank you all for contributing, it was scary, and I hope this case helps someone in need later.

3 Replies

Railway
BOT

6 days 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 6 days ago


Are there any errors in the logs?


6 days ago

The issue is likely not the MySQL service being offline, but a connectivity/configuration failure.

Please check the following:

Ensure the backend is NOT using localhost or 127.0.0.1. It must use Railway’s provided DATABASE_URL or the MySQL service variables (MYSQLHOST, MYSQLPORT, MYSQLUSER, MYSQLPASSWORD, MYSQLDATABASE).

Verify the database service variables are still present and unchanged. If any were reset or missing, the backend will not be able to connect even if the service shows “online”.

Check MySQL logs for errors such as:

“Too many connections”

“InnoDB error / corruption”

“aborted connection”

If the service is not showing “ready for connections”, it is not actually healthy.

Restart ONLY the MySQL service (not just redeploy the backend), then wait 60–90 seconds before retrying.

If a volume is attached, there is a chance of corruption or unstable state. In that case, the fastest fix is to create a new MySQL service and migrate the data.

Ensure your backend is not creating a new database connection per request, as that can overload Railway MySQL and cause connection drops.

If the issue persists after these checks, the DB instance is likely unstable and should be replaced or redeployed with fresh credentials.


baraa4b
PROOP

6 days ago

Apparently it was a misconfiguration from the inside of the database, I have altered the password in the console to the current password (they were supposed to be the same anyway but I have no idea how it got changed, regarding the fact that I did multiple reconfiguration with service-volume to align the configurations).

Briefly: it was a password mismatch, but next level.

Here is what I did to resolve it, in mySQL service, the console tab:

  1. first I added those flags to the custom start command on the service itself, to access the db without the password:

"mysqld --skip-grant-tables --skip-networking"

  1. then I ran this "mysql --socket=/var/run/mysqld/mysqld.sock -u root"

to access the database.

  1. after that I got into the db I ran this query:

"""

FLUSH PRIVILEGES;

ALTER USER 'root'@'%' IDENTIFIED BY 'TheSamePasswordThatWasInTheSerivceEnv';

FLUSH PRIVILEGES;

EXIT;

"""

  1. then I removed the flags I added in step 1, redeployed, and boom, everything was fine again.

thank you all for contributing, it was scary, and I hope this case helps someone in need later.


Status changed to Solved brody 6 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...