mysql-container icon indicating copy to clipboard operation
mysql-container copied to clipboard

Is it possible to create more than one database when init container?

Open EKwongChum opened this issue 5 years ago • 2 comments

While we use this resposity's image mysql-57-centos7 ,we want to create more than one database when init container. Is it possible to run some commands like

docker container run --detach --name mysql_database -e MYSQL_USER=myuser -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db1,db2,db3 -p 3306:3306 mysql-57-centos7:latest

to create three databases: db1, db2 and db3 when init container?

EKwongChum avatar May 20 '20 02:05 EKwongChum

It is possible to extend the image by mounting some SQL query and a script to a proper place or building you own layer on top of the image. See the "Extending image" section in the doc: https://github.com/sclorg/mysql-container/tree/master/8.0#extending-image

hhorak avatar Feb 22 '21 11:02 hhorak

Well, the suggested approach in #287 might be actually a nice enhancement. We'll consider it.

hhorak avatar Feb 22 '21 11:02 hhorak