-
-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL works on first run, then won't connect again #542
Comments
@pnoeric thanks for the very detailed bug description. As I've never experienced this bug myself (running Linux), I made a few searches and what I came up with: In case your OS went to sleep once the container where running, this might have caused it. Once suggestion is not only to stop the Docker container, but to also restart the Docker engine. |
As a second step to try (once the first thing did not succeed) is to
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
14f15146ee03 bridge bridge local
ad26b2d09381 devilbox_app_net bridge local
$ docker network rm ad26b2d09381
|
Ok - I just quit the Docker Desktop completely (which I assume restarts the docker engine) and relaunched it. Let's see what happens when I spin up the box now... nope, no luck. Now I'll try the 2nd step, stopping the container, removing it, removing the devilbox network and restarting the engine too. By the way, I don't know if this is a clue, but when I do FWIW I have no idea what the 'bridge' 'host' and 'null' networks are... not sure if those are supposed to be there or not... Docker is a bit foreign to me. ;-) I can tell you that I'm not running any other Docker projects or whatever right now... could those be anything related to the problem? Anyhow. Ok. Docker just restarted so now let me spin up Devilbox again... no luck :-( I really appreciate your help in trying to get to the bottom of this; Devilbox is exactly what I had in mind when I posted this on StackExchange. ;-) What else can I do or provide? Could it be something in the container holding the mysql engine... anything I can check there? |
These are also shown on my output and come by default. I just cut it as I had lots of networks. By looking at your provided Three other things that could come to my mind are:
|
Ok, thanks. It's late here in Switzerland so I'll give this a crack tomorrow and report back. You're absolutely right that the |
Also note that if you've already added data to MySQL when you where on the master branch, it won't be available in the release branch as the two branches use different concepts of where to store the data.
Additionally on the master branch, the Devilbox uses custom Docker images for MySQL and on the release branch the official Docker images for MySQL are used. So can you give their issue tracker a shot as well and see if anything related can be found there: https://github.com/docker-library/mysql/issues |
Hmmm let me ask you this... I don't care about blowing away my current installation, my data, whatever. I'd rather get it working reliably and then build from there. What's the best way to start over everything from scratch from my machine? I'm thinking delete everything, then download a fresh devilbox per the instructions, then switch the 1.0.0 branch so I get whatever new MySQL server, I'll make a fresh Do I just drag the entire devilbox folder to the trash and start cold that way? Is there anything else I need to delete? |
Cleanest way is to (Ensure needed data is backed up):
How to view/remove volumes
|
Just to be extra cautious, also restart the Docker engine before starting the newly cloned Devilbox stack. |
SO... it looks like the issue is something with my giant database making the MariaDB unhappy. However there are no error messages in the startup, just a few small warnings. Here is what I see from the most recent startup: Maybe a way to attack this would be to go into the database container and get more details about what's going on? Or, what do you think? |
By the way, after the above, to fix the situation, I did this:
So now I just need to NOT shut down the docker container or else I have to repeat this whole process again. The import takes a while since the db is so big! This is not ideal but it's a workaround for now. But I would love to find the problem so we can solve it. Thank you for all your help! |
Try to go into the MySQL container:
And then connect locally to the database for further inspection:
|
It could very well also just be a simple bug in the intranet code for querying the database for display. |
You could actually check this right away: If the Database is shown as not available, does phpMyAdmin still work? |
Ok, I went logged in directly to the db container (
So... hmm. Seems like the issue is definitely in docker somewhere, like devilbox can't connect to that other container any longer. What can I do next? |
In the MySQL container can you check/provide
In the PHP container can you check/provide
|
In MySQL container -- netstat
In MySQL container -- pinging self
In MySQL container -- pinging php container
In PHP container - pinging MySQL container
In PHP container - trying to connect to mysql
I'm not sure how to interpret any of these results but hopefully that gives us some useful data... |
Are these the results when the MySQL container is working or is broken? |
And what about |
Oh hell. Just had a thought. I wonder if I am importing some access rules into MySQL, when I do the big import? |
Don't you just hate that moment of discovery, when you realize it was something stupid all along? ;-) That was it. Apparently the production server dramatically restricted access to the db, so the mysql.user table was set in a way that didn't let an outside user (like the php container) connect to the database. I did a quick Now I see why it worked until I rebooted: on import, the new access rules were in place but those are only loaded when the MySQL server starts up. So the current session (at that time) would continue to run just fine. But on the next startup, the new access rules would be parsed and the php container was then locked out. Thank you so much, cytopia, for all your help along the way. Perhaps we can salvage some of this work and add it to the troubleshooting section of the documentation, as things to try. Or maybe if there is a 'sanity check' script on the mysql container, this could be something it checks, that the php container has access. I'm kind of embarrassed! And at the same time, very happy to have this working! |
Docs will be available here shortly: https://devilbox.readthedocs.io/en/latest/support/troubleshooting.html |
ISSUE TYPE
Checklist
.env
file is attached - my-dot-env.txt - note that I did nothing except what is in the docs and selected MariaDB 5.5 since it matches the production server, otherwise it is same as default-envdocker-compose.override.yml
is attached (if it exists) - DOES NOT EXISTcfg/
dir are attached (if customized) - NONEdocker-compose logs
andlog/
output is addedmy-docker-compose-logs.txt
in the mariadb-5.5 folder are 3 files (error.log, query.log, slow.log), all of them are 0 bytes
OS / ENVIRONMENT
also I am using Mac Docker Desktop, the latest version which is Version 2.0.0.3 (31259)
SUMMARY
Short summary - Everything works great on first startup, then I shut down as the docs describe, start the box again, and MySQL is dead. Possible same as issue #500 ?
Longer explanation - I installed devilbox following the docs exactly and it worked perfectly first try. Wow! Then I exported a 1.5 GB MySQL db from another server and imported it into the local MariaDB inside of devilbox. No errors and I could use my site locally with the db, everything was perfect.
I shut down (following the steps in the docs) and then started it up again... and now can't connect to the MySQL server. There are no errors on startup that I notice, but as you can see the server is unhappy:
STEPS TO REPRODUCE
EXPECTED BEHAVIOUR
MySQL can always connect
ACTUAL BEHAVIOUR
MySQL craps out after the 1st run
OTHER INFORMATION
Start command
File and user permissions (Linux & MacOS)
The text was updated successfully, but these errors were encountered: