Error establishing a database connection again

Unfortunately, I am no longer able to run my website on Local By Flywheel.
I tried to run this in terminal: service mysql start and I get this back A MySQL Server is already started..
I’ve attached my local-by-flywheel.log file.
local-by-flywheel.log (57.6 KB)

This seems to be a problem that happens with Local By Flywheel once in a while. Maybe there should be more documentation on how to read the local-by-flywheel.log file? It certainly is not the first time I have run into this issue. But it’s very hard to to under stand the log file.
Would you please create a post about possible ways of debugging and wand ways of fixing this problem?

Hey @vayu

Are there certain things that seem to cause this error? For example, does it happen shortly after starting the site, or after certain actions on the site?

In terms of troubleshooting this sort of thing – if it happens shortly after starting the site, it’s likely due to the site not having been fully started. Usually waiting for a minute allows for the db to fully start and start receiving connections.

If it happens after certain actions while working with WordPress, then it’s likely some sort of code that is crashing the DB. You can often find more information by reviewing the logs found in the logs folder of the site. For mysql, the error log is located at logs/mysql/error.log which should point you in the right direction.

Hope that helps clarify things. Let me know if you have any other questions!

– Ben

Thanks @ben.turner, but I don’t think it’s neither. I am not able to access the database with Adminer or Sequel Pro too.
I have also already looked in the site->logs->mysql->error.log file, and it’s also hard to become wise from the data there. The site was working last time I worked on it, but something must have happened with database.

Okay wait, this is very weird! I tried to stop the site and then start it again just for the heck of it, and now it works! I did this many times yesterday and like you said, I waited a while before trying to access the site. I waited maybe 5 minutes or more. Anyways strange stuff, thanks for helping! :slight_smile:

Great to hear @vayu!