[MDEV-27638] Extend "MYSQL_DATABASE" ENV value Created: 2022-01-27  Updated: 2023-09-19

Status: Open
Project: MariaDB Server
Component/s: Docker
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Madpeter Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Currently MYSQL_DATABASE only supports creating one database forcing a dirty CMD int hack to workaround

I would like this to support CSV so you can create multiple databases with the same user.
without having to mess around with CMD and init files.



 Comments   
Comment by Daniel Black [ 2022-01-27 ]

I'm ok with this concept.

Did you want to write a change to https://github.com/MariaDB/mariadb-docker/blob/master/docker-entrypoint.sh ?

Keep the MYSQL_DATABASE/MARIADB_DATABASE as simple (non-array) variables and ensure that docker_exec_client just uses the first in the list.

Comment by Daniel Black [ 2022-02-10 ]

From https://github.com/MariaDB/mariadb-docker/pull/409#issuecomment-1030646420

Mostly I'm like "why not" on this. The only problem I see is how we're going to deal with docker_exec_client: Users expect MYSQL_DATABASE and MARIADB_DATABASE to be a single database name, so we must add yet another env variable. I definitely wouldn't use CSV, but a simple space separated list.

So considering the not so obvious implementation: Why not /docker-entrypoint-initdb.d? This is no more than creating a /docker-entrypoint-initdb.d/create-another_database.sql with

CREATE DATABASE IF NOT EXISTS `another_database`;
GRANT ALL ON `another_database`.* TO 'my_sql_user'@'%';

Yes. for docker_exec_client we should trim this down to the first database of the CSV.

Madpeter do you have an answer for why not docker-entrypoint-initdb.d?

Generated at Thu Feb 08 09:54:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.