1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

[MDEV-14978] Client programs to use $MARIADB_HOST consistently

Only `mysql` client program was using $MYSQL_HOST as the default host.
Add the same feature in most other client programs but using
$MARIADB_HOST instead.

All new code of the whole pull request, including one or several files that are
either new files or modified ones, are contributed under the BSD-new license. I
am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
Ocean Li
2024-07-15 18:54:55 +00:00
committed by Andrew Hutchings
parent 383d1f90dd
commit eedbb901e5
11 changed files with 152 additions and 17 deletions

View File

@@ -611,8 +611,9 @@ static struct my_option my_long_options[] =
"engine after a `:', like memory:max_row=2300",
&default_engine, &default_engine, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host. Defaults in the following order: "
"$MARIADB_HOST, and then localhost",
&host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-command", 0,
"SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.",
@@ -1186,6 +1187,9 @@ get_options(int *argc,char ***argv)
if (debug_check_flag)
my_end_arg= MY_CHECK_ERROR;
if (host == NULL)
host= getenv("MARIADB_HOST");
/*
If something is created and --no-drop is not specified, we drop the
schema.