diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index deabc099f..e3eb56941 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -5,7 +5,9 @@ get_option () { local section=$1 local option=$2 local default=$3 - ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-) + # my_print_defaults can output duplicates, if an option exists both globally and in + # a custom config file. We pick the last occurence, which is from the custom config. + ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1) [ -z $ret ] && ret=$default echo $ret } diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 8e85cfe92..10c79f470 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -5,7 +5,9 @@ get_option () { local section=$1 local option=$2 local default=$3 - ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-) + # my_print_defaults can output duplicates, if an option exists both globally and in + # a custom config file. We pick the last occurence, which is from the custom config. + ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1) [ -z $ret ] && ret=$default echo $ret } diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index f8d0086f2..d3b201684 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -5,7 +5,9 @@ get_option () { local section=$1 local option=$2 local default=$3 - ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-) + # my_print_defaults can output duplicates, if an option exists both globally and in + # a custom config file. We pick the last occurence, which is from the custom config. + ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1) [ -z $ret ] && ret=$default echo $ret } @@ -77,6 +79,7 @@ if [ "$1" = 'mysqld' ]; then echo 'FLUSH PRIVILEGES ;' >> "$tempSqlFile" mysql -uroot < "$tempSqlFile" + rm -f "$tempSqlFile" kill $(cat $PIDFILE) for i in $(seq 30 -1 0); do @@ -95,4 +98,3 @@ if [ "$1" = 'mysqld' ]; then fi exec "$@" -