Commit cfe0f1bb authored by Daniel Black's avatar Daniel Black

MDEV-23494: mysql_install_db add --auth-root-hostname option

This allows an install script to be specific on the hostname
for the root user.
parent 8ecf8dc7
...@@ -40,6 +40,7 @@ auth_root_authentication_method=normal ...@@ -40,6 +40,7 @@ auth_root_authentication_method=normal
auth_root_socket_user='root' auth_root_socket_user='root'
tzdir= tzdir=
skip_anonymous= skip_anonymous=
explicit_hostname=
dirname0=`dirname $0 2>/dev/null` dirname0=`dirname $0 2>/dev/null`
dirname0=`dirname $dirname0 2>/dev/null` dirname0=`dirname $dirname0 2>/dev/null`
...@@ -60,6 +61,8 @@ Usage: $0 [OPTIONS] ...@@ -60,6 +61,8 @@ Usage: $0 [OPTIONS]
specifies the name of the MariaDB root account, as well specifies the name of the MariaDB root account, as well
as of the system account allowed to access it. Defaults as of the system account allowed to access it. Defaults
to 'root'. to 'root'.
--auth-root-hostname=name
Use name as host for root user without DNS resolving it.
--basedir=path The path to the MariaDB installation directory. --basedir=path The path to the MariaDB installation directory.
--builddir=path If using --srcdir with out-of-directory builds, you --builddir=path If using --srcdir with out-of-directory builds, you
will need to set this to the location of the build will need to set this to the location of the build
...@@ -176,6 +179,8 @@ parse_arguments() ...@@ -176,6 +179,8 @@ parse_arguments()
auth_root_authentication_method=normal ;; auth_root_authentication_method=normal ;;
--auth-root-authentication-method=socket) --auth-root-authentication-method=socket)
auth_root_authentication_method=socket ;; auth_root_authentication_method=socket ;;
--auth-root-hostname=*)
explicit_hostname=`parse_arg "$arg"` ;;
--auth-root-authentication-method=*) --auth-root-authentication-method=*)
usage ;; usage ;;
--auth-root-socket-user=*) --auth-root-socket-user=*)
...@@ -449,7 +454,7 @@ fi ...@@ -449,7 +454,7 @@ fi
hostname=`@HOSTNAME@` hostname=`@HOSTNAME@`
# Check if hostname is valid # Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 -a -z "$explicit_hostname"
then then
resolved=`"$resolveip" $hostname 2>&1` resolved=`"$resolveip" $hostname 2>&1`
if test $? -ne 0 if test $? -ne 0
...@@ -513,7 +518,11 @@ fi ...@@ -513,7 +518,11 @@ fi
# When doing a "cross bootstrap" install, no reference to the current # When doing a "cross bootstrap" install, no reference to the current
# host should be added to the system tables. So we filter out any # host should be added to the system tables. So we filter out any
# lines which contain the current host name. # lines which contain the current host name.
if test $cross_bootstrap -eq 1 if test -n "$explicit_hostname"
then
# First @current_hostname in out is settings its value
filter_cmd_line="sed -e '/INTO @current_hostname/c\\\nset @current_hostname=\"${explicit_hostname}\";'"
elif test $cross_bootstrap -eq 1
then then
filter_cmd_line="sed -e '/@current_hostname/d'" filter_cmd_line="sed -e '/@current_hostname/d'"
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment