File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 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() {
176176
177177# Creates initial database users and schema
178178docker_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
179184 # Sets root password and creates root users for non-localhost hosts
180185 rootCreate=
181186 # default root to listen for connections from anywhere
@@ -239,12 +244,6 @@ mysql_expire_root_user() {
239244 fi
240245}
241246
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-
248247# Load timezone info into database
249248docker_load_tzinfo () {
250249 # sed is for https://bugs.mysql.com/bug.php?id=20545
@@ -285,10 +284,6 @@ _main() {
285284 docker_load_tzinfo
286285 fi
287286
288- if [ ! -z " $MYSQL_RANDOM_ROOT_PASSWORD " ]; then
289- docker_generate_root_password
290- fi
291-
292287 docker_setup_db
293288
294289 echo
You can’t perform that action at this time.
0 commit comments