Fix mysql_install_db to create initial root without a password

rather than the new mode of only via system root user
This commit is contained in:
Joe Ferguson 2019-02-27 16:47:52 -08:00
parent 9d64941afc
commit 43ab06b91a
7 changed files with 56 additions and 7 deletions

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"

View File

@ -90,8 +90,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
mkdir -p "$DATADIR"
echo 'Initializing database'
installArgs=( --datadir="$DATADIR" --rpm )
if { mysql_install_db --help || :; } | grep -q -- '--auth-root-authentication-method'; then
# beginning in 10.4.3, install_db uses "socket" which only allows system user root to connect, switch back to "normal" to allow mysql root without a password
# see https://github.com/MariaDB/server/commit/b9f3f06857ac6f9105dc65caae19782f09b47fb3
# (this flag doesn't exist in 10.0 and below)
installArgs+=( --auth-root-authentication-method=normal )
fi
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
mysql_install_db --datadir="$DATADIR" --rpm "${@:2}"
mysql_install_db "${installArgs[@]}" "${@:2}"
echo 'Database initialized'
SOCKET="$(_get_config 'socket' "$@")"