From 159076f894ae55ddf6b7e58fc432192f9943363b Mon Sep 17 00:00:00 2001 From: Guy Matz Date: Mon, 13 Jun 2022 13:08:03 -0400 Subject: [PATCH] Added an ENV var to be set to an additional - optional - directory for mysql initialzition files --- percona-server-5.7/README.md | 4 ++++ percona-server-5.7/ps-entry.sh | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/percona-server-5.7/README.md b/percona-server-5.7/README.md index d4df9c3b6..d07217a3f 100644 --- a/percona-server-5.7/README.md +++ b/percona-server-5.7/README.md @@ -86,6 +86,10 @@ Set to `1` to allow the container to be started with enabled ROCKSDB engine. Set to `1` will skip starting the `mysqld` process and will run only the initialization part if MySQL was not initialized before. +## `MYSQL_INIT_DB` + +Set to directory where initialization files reside. This is an additional directory for initialzation, on top of the default directory, /docker-entrypoint-initdb.d + # Notes, Tips, Gotchas ## Secure Container Startup diff --git a/percona-server-5.7/ps-entry.sh b/percona-server-5.7/ps-entry.sh index 4be247d62..945ef70e7 100755 --- a/percona-server-5.7/ps-entry.sh +++ b/percona-server-5.7/ps-entry.sh @@ -202,6 +202,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then process_init_file "$f" "${mysql[@]}" done + ls $MYSQL_INIT_DIR > /dev/null + for f in ${MYSQL_INIT_DIR}/*; do + process_init_file "$f" "${mysql[@]}" + done + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then "${mysql[@]}" <<-EOSQL ALTER USER 'root'@'%' PASSWORD EXPIRE;