diff --git a/root-common/usr/share/container-scripts/mysql/common.sh b/root-common/usr/share/container-scripts/mysql/common.sh index a2a1fe71..3ea7a0d4 100644 --- a/root-common/usr/share/container-scripts/mysql/common.sh +++ b/root-common/usr/share/container-scripts/mysql/common.sh @@ -52,6 +52,7 @@ export MYSQL_DATADIR_FIRST_INIT=false # Be paranoid and stricter than we should be. # https://dev.mysql.com/doc/refman/en/identifiers.html mysql_identifier_regex='^[a-zA-Z0-9_]+$' +mysql_dbname_identifier_regex='^[a-zA-Z0-9_,]+$' mysql_password_regex='^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$' # Variables that are used to connect to local mysql during initialization @@ -169,15 +170,18 @@ EOSQL fi if [ -v MYSQL_DATABASE ]; then - log_info "Creating database ${MYSQL_DATABASE} ..." - mysqladmin $admin_flags create "${MYSQL_DATABASE}" + # split MYSQL_DATABASE by , + for item in $(echo "${MYSQL_DATABASE}" | tr "," "\n"); do + log_info "Creating database ${item} ..." + mysqladmin $admin_flags create "${item}" if [ -v MYSQL_USER ]; then - log_info "Granting privileges to user ${MYSQL_USER} for ${MYSQL_DATABASE} ..." + log_info "Granting privileges to user ${MYSQL_USER} for ${item} ..." mysql $mysql_flags <