docker-library / docker-library/mysql
Why can't I create more than one schema?
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 2.6k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using mysql:8.0, with MYSQL_DATABASE: pvet_production_db, and two scripts in docker-entrypoint-initdb.d: one that creates all the tables and inserts data (1_database.sql.gz) and another one that does some pseudoanonymization on the data (2_anonymize.sql.gz), and both work on the schema specified on the variable (the first file has a use statement, the second one does not but still works); up to here everything works as expected.
Now I would like to add another schema, but for some reason, I can't: I added another file (0_test_database.sql.gz) which does the same as 1_database.sql.gz on a different schema, but it doesn't work. I also added 0_create_schemas.sql with just the creation statements for both schemas, but no luck. I can see these files being listed during the bootstrap of the container, but it is like nothing happens. From my testing, it looks like only the operations for the schema defined in the MYSQL_DATABASE happen.
I also added https://github.com/docker-library/postgres/issues/179#issuecomment-510133799 (replacing psql with mysql), and it is picked up but doesn't do anything either.
What am I missing?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MySQL 8.0 initialization behavior for files in docker-entrypoint-initdb.d, then compare 0_create_schemas.sql, 0_test_database.sql.gz, and 1_database.sql.gz with the working MYSQL_DATABASE flow. Check how the listed files are executed and how schema selection is established. Done means both schemas are created and the second schema's tables and data are initialized during bootstrap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, mysql, sql
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100