-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Impossible to upgrade mysql #130
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
Comments
Did you try running just the mysql_upgrade command? i.e. I see this might have permission issues, since the entrypoint script will only try to ensure the correct datadir permissions if the supplied command is mysqld. Will look into that a bit more. |
It's not exactly that, I would like to start my container and force to upgrade if necessary. It's not possible to do that automatically on start of the container? |
I was running into the same problem. In my case, I was attempting to load a dump file from an older version of mysql (v 5.1, though the dump was created with the tool from 5.7) per the instructions on mounting a .sql file when running the container. The import works fine, then the database crashes after restarting with:
I blew that container away & rebuilt it using the version 5.6 tag of the mysql image. Import worked fine and the container works as expected. Since the container exits immediately upon the database failing to load, I suspect that I will not be able to upgrade this (easily) to Mysql 5.7 in the future... Would be great if the image was smart enough to run [Important note: I'm new to Docker, so maybe I'm missing an easy way to run a specific command on this container without it currently running? Or, perhaps there's an easy way to mount the mysql data directory in this container from a different container that runs the upgrade command? Maybe I'd need to keep my data in a third "data volumes" container for that to be an option? Sorry.] |
Hi, In general, you can pick which command is run on an image by adding it to the end of the run command. The default for the mysql image is mysqld, but you can replace it with anything, i.e. Note: Upgrading is definitely something we should add to docs |
I only really considered a major upgrade such as 5.6 to 5.7, but our docs do recommend always running mysql_upgrade for any new version. We may want to try to detect any upgrades in server versions and run mysql_upgrade in the image script. |
ah - I think where I went wrong with this is that I used the Thanks for the help. |
We could store the version with the database, maybe. The init script could compare the version in the file with the current database, and run mysql_upgrade if they differ (and give some other error if the existing database is actually from a newer server version). |
I ran into the same problem, this worked for me:
|
@ltangvald As to whether we should do it by default -- is it ever potentially destructive or expensive? Does it have any adverse effects for clustering, for example? Will defer to your judgement on whether it's something we should do (and the best way to do so safely), but I also want to make sure we ask the right questions first to ensure we don't shoot ourselves in the foot down the line. 😅 |
Yes, mysql_upgade is simply a client, so it needs to connect to a running server with admin credentials. It should be completely non-destructive, but I'll ask around a bit to make sure there aren't any corner cases where it can break things (it's worth noting that in native distro packages, mysql_upgrade is always run on package upgrades). So while it should be safe to run it every time, the main issue with running automatically is that it requires admin credentials to do so, and the only time we know these are when the database is new and therefore doesn't need upgrading :) What we could do is add a check for the token file, and if it's not there, remind users to run mysql_upgrade? |
Adding a reminder sounds like a sane middle-ground -- easy to upgrade from that to automated behavior if it more clearly makes sense in the future! 👍 |
@ltangvald ho ho ho 🎅 😄 This one's been sitting for a year, do you think it's still relevant? |
I'm assigning this to myself, and make an implementation of the reminder :) |
So 9 months later, it seems like this isn't resolved. Is this not important? My concern is that if we're on How are users expected to upgrade? There is zero documentation about upgrades on the Docker Hub page, and I'm not sure what the current process is. Ideally, the upgrade would be transparently done. Meaning, at startup, the container entrypoint script first checks if an upgrade is needed, performs that upgrade, and then continues running normally. |
Right, the idea is to add this to/after pr #471 which splits up the entrypoint so we can reuse the logic for e.g. doing a temporary server startup |
I am waiting for the fix eagerly. I couldn't even upgrade from 5.7.22-1debian9 to 5.7.24-1debian9. |
Waiting for this fix as well. We run persistent mysql and are going from 5.6 -> 5.7 and a built in mysql_upgrade command would be very helpful. |
just fyi, because I got here via google while trying to update a mysql-8 db which runs in docker/docker-compose: Since mysql8
Start it once, after it has updated, stop it and remove the |
@ltangvald now that we've got #471 (and given it's changed in 8+), what do you think we should do here? 😇 ❤️ |
I had a patch for this... somewhere... Oh, pr #416 |
i.e. something like this: ltangvald/docker-library-docs@b98cacf |
@ltangvald I think the content looks ok to me (though it will need to be in |
Is it finally time to close this one as "fixed in 8.0+" ? 🙈 ❤️ |
Closing per #416 (comment) |
I'm using docker-compose with existant datas on my mysql container.
Is it possible to execute mysql_upgrade without create my own image of mysql based on the official mysql?
In fact, when I change mysql version from 5.7.7 to 5.7.9, I'm obliger to call mysql_upgrade to have the right database, table, ... structures.
I'm trying in docker-compose to execute multiple command like:
command: mysqld && mysql_upgrade
But your default entrypoint add "&& mysql_upgrade" like parameters of mysqld and not to execute another process.
I was oblige to override the docker-entrypoint.sh to forced mysql_upgrade (see attach file)
docker-entrypoint.sh.zip
The text was updated successfully, but these errors were encountered: