Repository navigation
Conversation
The GRANT SYSTEM_USER statement hardcoded 'mysql_user' as the
username, breaking any fresh install that uses a different
MYSQL_USER value (fails with 'You are not allowed to create a
user with GRANT' on MySQL 8.4 since that literal user doesn't
exist).
db/init-grants.sh already does this exact grant correctly and
dynamically via ${MYSQL_USER}, so the line in data.sql was both
redundant and the actual cause of the bug. Removing it lets a
fresh install use any DB username.
There was a problem hiding this comment.
Pull request overview
Fix MySQL seed init failure on fresh deploy when MYSQL_USER != mysql_user, by removing dead, hardcoded GRANT ... TO 'mysql_user'@'%' from db/data.sql (dynamic grant already in db/init-grants.sh).
Changes:
- Delete hardcoded
GRANT SYSTEM_USER ... TO 'mysql_user'@'%'+FLUSH PRIVILEGESfromdb/data.sql - Keep privilege grant path via
db/init-grants.shusing${MYSQL_USER}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Owner
Author
|
נסגר ככפילות: השינוי ב-data.sql כלול ב-#148 (יחד עם docker-compose ל-MySQL משותף). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Removes a redundant, hardcoded
GRANT SYSTEM_USER ON *.* TO 'mysql_user'@'%'; FLUSH PRIVILEGES;fromdb/data.sql.Why
Ran into this deploying a fresh instance (Dokploy,
db/Dockerfilebuilding the seeded MySQL image): withMYSQL_USERset to anything other than the literal stringmysql_user, the database container's init step failed outright:MySQL 8.4 no longer allows a bare
GRANTto implicitly create a nonexistent user. Since the official MySQL entrypoint auto-creates theMYSQL_USERaccount before running/docker-entrypoint-initdb.d/scripts, this only ever worked whenMYSQL_USER=mysql_userexactly — any other username broke the whole seed script (schema +migrationstable population), leaving a completely empty database. From there,typeorm:runtries to replay full migration history from scratch, and the very first migration (KlassAddReferenceId1675356165986) crashes because it assumes aklassestable that only ever existed via this checkpoint or historicalsynchronize.db/init-grants.shalready performs this exact grant correctly, using${MYSQL_USER}dynamically. The line indata.sqlwas dead weight and the actual point of failure.Verification
Rebuilt the
dbimage with a non-defaultMYSQL_USER/MYSQL_DATABASE/MYSQL_PASSWORDagainst this fix — init completes cleanly,migrationstable is seeded as expected, and the server boots and passes its healthcheck against the resulting database.Scope note: this only fixes the specific breakage above. It doesn't change anything about how a truly empty database (skipping
db/data.sqlentirely) would still need to replay all 164 migrations from asynchronize-era baseline that doesn't exist in migration history — that's a separate, bigger discussion if it's worth solving generally.Generated by Claude Code