File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,11 @@ docker_init_client_command() {
176
176
177
177
# Creates initial database users and schema
178
178
docker_setup_db () {
179
+ # Generate random root password
180
+ if [ ! -z " $MYSQL_RANDOM_ROOT_PASSWORD " ]; then
181
+ export MYSQL_ROOT_PASSWORD=" $( pwgen -1 32) "
182
+ mysql_note " GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD "
183
+ fi
179
184
# Sets root password and creates root users for non-localhost hosts
180
185
rootCreate=
181
186
# default root to listen for connections from anywhere
@@ -239,12 +244,6 @@ mysql_expire_root_user() {
239
244
fi
240
245
}
241
246
242
- # Generate a random root password
243
- docker_generate_root_password () {
244
- export MYSQL_ROOT_PASSWORD=" $( pwgen -1 32) "
245
- mysql_note " GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD "
246
- }
247
-
248
247
# Load timezone info into database
249
248
docker_load_tzinfo () {
250
249
# sed is for https://bugs.mysql.com/bug.php?id=20545
@@ -285,10 +284,6 @@ _main() {
285
284
docker_load_tzinfo
286
285
fi
287
286
288
- if [ ! -z " $MYSQL_RANDOM_ROOT_PASSWORD " ]; then
289
- docker_generate_root_password
290
- fi
291
-
292
287
docker_setup_db
293
288
294
289
echo
You can’t perform that action at this time.
0 commit comments