File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 50
50
fi
51
51
52
52
# Make sure all user and database settings are set and pass is more than 4 characters
53
+ # At the end change to default database created with environment variables to run init and remote scripts there
53
54
if [ "${MYSQL_USER+x}" ] && \
54
55
[ "${MYSQL_DATABASE+x}" ] && \
55
56
[ "${MYSQL_PASSWORD+x}" ] && \
@@ -58,6 +59,7 @@ read -r -d '' MYSQL_DB_SETUP << EOM
58
59
CREATE DATABASE \`${MYSQL_DATABASE}\`;
59
60
CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';
60
61
GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%';
62
+ USE \`${MYSQL_DATABASE}\`;
61
63
EOM
62
64
fi
63
65
@@ -70,8 +72,6 @@ $MYSQL_DB_SETUP
70
72
EONEWSQL
71
73
echo "Setting Up Initial Databases"
72
74
73
- echo "USE ${MYSQL_DATABASE};" >> "$tempSqlFile"
74
-
75
75
# add all sql from a user defined directory on first init
76
76
if ([ -e "/config/initdb.d" ] && [ -n "$(/bin/ls -A /config/initdb.d/*.sql 2>/dev/null)" ]); then
77
77
cat /config/initdb.d/*.sql >> "$tempSqlFile"
You can’t perform that action at this time.
0 commit comments