Skip to content

Commit f16150e

Browse files
ltangvaldyosifkit
authored andcommitted
Unify entrypoint scripts for 5.7 and 8.0
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
1 parent d56d41d commit f16150e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

5.7/docker-entrypoint.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ _check_config() {
7777
# latter only show values present in config files, and not server defaults
7878
_get_config() {
7979
local conf="$1"; shift
80-
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }'
80+
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \
81+
| awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }'
82+
# match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)"
8183
}
8284

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

0 commit comments

Comments
 (0)