I can no longer connect to my MySQL database, even after restarting the database

I'm not sure what my project id is. My link is this: https://railway.app/project/31b9ee92-06cc-44c1-b7ac-f0e1ce21e2f1 So basically I'm using this database to serve my website. I released to production and I was having issues where the connections would drop from inactivity after a few minutes. Consulting ChatGPT, it said a dirty fix would be a periodic ping of the database to keep the connection going, so I set on up on a 2 minute timer. This worked for a day or two perhaps, before the database wouldn't allow a connection, either from production environment or even locally or from MySQL Workbench. I hopped on the Railway website, hit "restart database", and everything was fine, for another day. Now I am unable to connect to the database in any way, even when I attempt to restart the database again. I'm inexperienced with this kind of thing and would appreciate help from those wiser than I.
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
20 Replies
Percy
Percyβ€’10mo ago
Project ID: 31b9ee92-06cc-44c1-b7ac-f0e1ce21e2f1
Brody
Brodyβ€’10mo ago
and you are absolutely positively sure you are using the correct credentials when using mysql workbench?
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
90% sure I'd suppose. I'm trying to connect in the same ways using the same saved values that have always worked before this issue. I checked to see that the database should be using the same port as it's always been using, etc.
Brody
Brodyβ€’10mo ago
go and copy the credentials fresh from the mysql database plugin itself
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Yes sir, just a sec
Brody
Brodyβ€’10mo ago
if you get an error, take a screenshot to show me
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
"Unable to connect to localhost" It seems to not be sure even what the problem could be.
Brody
Brodyβ€’10mo ago
it seems as though you may not be entering the credentials correctly
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
I suppose that's possible. But even if I try to play with the database inside the Railway site, it doesn't seem to want to cooperate.
Brody
Brodyβ€’10mo ago
alright i will flag the team, because its clear that at least something happened that shouldn't have
Duchess
Duchessβ€’10mo ago
Thread has been flagged to Railway team by @Brody.
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Thank you, I appreciate that.
Brody
Brodyβ€’10mo ago
@Ray - hey I think this needs a little attention πŸ™‚
Ray
Rayβ€’10mo ago
^ Thanks! @Swordgeo did you run any queries to alter the db?
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Not as far as I know. I had just released my site to production, and was encountering a problem of connections timing out naturally after a few minutes. So I set up a ping to kinda keep it open like so: setInterval(() => { connection.query('SELECT 1', (err) => { if (err) { console.error('Error pinging database:', err); } else { console.log('Pinged database successfully.'); } }); }, 2.5 * 60 * 1000); // Ping every 2.5 minutes In hindsight something about this is probably where the stupidity happened. After a day or two that's when I stopped being able to connect entirely.
Ray
Rayβ€’10mo ago
Do you have any important production data on it? Looks like your db is in an unrecoverable state due to data corruption; we've never seen this before and not sure how it happened. I'll dig further next week and attempt a restore for you. Sorry bout this 🀞
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Gotcha. As far as "important" data, sure, it will be a pain, but I can recover all of it in due time. I've partially set up the means to do so. If something can be recovered, awesome; if there's nothing that can be done it is what it is. Thank you for the help; now I don't have to wonder and spin my wheels. If you could let me know when I can begin rebuilding I'd greatly appreciate that.
Ray
Rayβ€’10mo ago
Can I DM you?
Swordgeo 🍐
Swordgeo πŸβ€’10mo ago
Certainly. Lay it on me and I’ll happily respond tomorrow morning