Skip to content

Automatically run mysql_upgrade for 8.0 image #416

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

Closed
wants to merge 1 commit into from

Conversation

ltangvald
Copy link
Collaborator

It is recommended to always run mysql_upgrade when upgrading
MySQL, and it is required when upgrading from an older major version.

Entrypoint script checks if mysql_upgrade has previously been run on the
current version. If not it does a temporary startup and runs it.


This should fix most issues related from latest tag having changed from 5.7 to 8.0

It is recommended to always run mysql_upgrade when upgrading
MySQL, and it is required when upgrading from an older major version.

Entrypoint script checks if mysql_upgrade has previously been run on the
current version. If not it does a temporary startup and runs it.
local tmpdir=$1
chown mysql:mysql "$tmpdir"
# We use skip-grant-tables since we can't know the root credentials of existing databases
mysqld --skip-networking --pid-file="$tmpdir/mysqld.pid" --socket="$tmpdir/mysqld.sock" --daemonize --skip-grant-tables --log-error="$tmpdir/error.log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to use the same "$@" logic we use for the other place we start the daemon, doesn't it? (which is slightly complicated by it being a shell function and "$@" from the script itself being obscured)

Maybe we need to fully resolve what #402 starts (by functionalizing more parts of this file) so we can invoke the daemon in the same way (with a way to add --skip-grant-tables for this use case)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. I'll do some work on that first

@hachh
Copy link

hachh commented Jan 27, 2019

Hi,
I also need this feature, is it still under development ?

@TimWolla
Copy link
Contributor

This PR is no longer required as of MySQL 8.0.16: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-16.html

Previously, after installation of a new version of MySQL, the MySQL server automatically upgrades the data dictionary tables at the next startup, after which the DBA is expected to invoke mysql_upgrade manually to upgrade the system tables in the mysql schema, as well as objects in other schemas such as the sys schema and user schemas.

The server now performs the tasks previously handled by mysql_upgrade. After installation of a new MySQL version, the server now automatically performs all necessary upgrade tasks at the next startup and is not dependent on the DBA invoking mysql_upgrade. In addition, the server updates the contents of the help tables (something mysql_upgrade did not do). A new --upgrade server option provides control over how the server performs automatic data dictionary and server upgrade operations. For more information, see Upgrading MySQL.

@yosifkit
Copy link
Member

yosifkit commented May 7, 2019

For this image, the upgrade process is basically identical to the MySQL docs for upgrading the MySQL Server container:
https://dev.mysql.com/doc/refman/8.0/en/docker-mysql-getting-started.html#docker-upgrading

And since 8.0.16 does the upgrade automatically, I think we can close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants