-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add 'FLUSH PRIVILEGES;' to avoid creating 'root'@'${MYSQL_ROOT_HOST}' to be failed when MYSQL_ROOT_HOST isn't '%' #549
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
flytreeleft
wants to merge
3
commits into
docker-library:master
from
flytreeleft:PR-FIX-root-creation-failed
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do this twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
ERROR 1396 (HY000) at line 8: Operation CREATE USER failed for 'root'@'127.0.0.1'
will be thrown when trying to create'root'@'127.0.0.1'
if we do notFLUSH PRIVILEGES;
after'root'@'localhost'
is created.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure where the
127.0.0.1
is coming from. Are you settingMYSQL_ROOT_HOST
to127.0.0.1
?That works fine here (but means only
root
connections from within the container's network namespace):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a bit more research, it looks like this is limited to 5.5 and 5.6 when using
127.0.0.1
forMYSQL_ROOT_HOST
.It seems that the
GRANT
andSET PASSWORD
are fine, since "If you modify the grant tables indirectly using an account-management statement, the server notices these changes and loads the grant tables into memory again immediately" (mysql docs).The problem stems from using
DELETE FROM mysql.user
rather thanDROP USER
. So either theDELETE FROM
needs aFLUSH
or we switch toDROP USER
(https://stackoverflow.com/a/12343178).Ah! Does this not affect 5.7+ because they don't have
mysql_install_db
and the baggage of[email protected]
being pre-created?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yosifkit Yes, that's right.
FLUSH PRIVILEGES
isn't necessary for MySQL 5.7+. I will update the PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding another flush privileges, it should be enough to just move the existing one up, since as you say the DELETE FROM statement is the only one that needs a flush
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ltangvald Thanks, I have already removed the redundant flush statement.