Skip to content

Commit

Permalink
Unify entrypoint scripts for 5.7 and 8.0
Browse files Browse the repository at this point in the history
There were only two differences between the scripts:
* 8.0 had a fix for datadir settings with spaces in them
* 8.0 used alter user to set the root password, which 5.7 should also use
  • Loading branch information
ltangvald authored and yosifkit committed Sep 18, 2019
1 parent d56d41d commit f16150e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 5.7/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ _check_config() {
# latter only show values present in config files, and not server defaults
_get_config() {
local conf="$1"; shift
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }'
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \
| awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }'
# match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)"
}

# allow the container to be started with `--user`
Expand Down Expand Up @@ -161,7 +163,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
-- or products like mysql-fabric won't work
SET @@SESSION.SQL_LOG_BIN=0;
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
${rootCreate}
DROP DATABASE IF EXISTS test ;
Expand Down

0 comments on commit f16150e

Please sign in to comment.