Commit b6cfb296 authored by Brandon Nesterenko's avatar Brandon Nesterenko

MDEV-14974: --port ignored for --host=localhost

Problem:
=======
MariaDB's command line utilities (e.g., mysql,
mysqldump, etc) silently ignore connection
property options (e.g., --port and --socket)
when protocol is not explicitly set via the
command-line for localhost connections.

Fix:
===
If connection properties are specified without a
protocol, override the protocol to be consistent.
For example, if --port is specified, automatically
set protocol=tcp.

Caveats:
=======
 * When multiple connection properties are
specified, nothing is overridden
 * If protocol is is set via the command-line,
its value is used

Reviewers:
========
Sergei Golubchik <serg@mariadb.com>
Vladislav Vaintroub <wlad@mariadb.com>
parent 02380cd3
...@@ -136,3 +136,61 @@ enum options_client ...@@ -136,3 +136,61 @@ enum options_client
Name of the sys schema database. Name of the sys schema database.
*/ */
#define SYS_SCHEMA_DB_NAME "sys" #define SYS_SCHEMA_DB_NAME "sys"
/**
The --socket CLI option has different meanings
across different operating systems.
*/
#ifndef _WIN32
#define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_SOCKET
#else
#define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE
#endif
/**
Utility function to implicitly change the connection protocol to a
consistent value given the command line arguments. Additionally,
warns the user that the protocol has been changed.
Arguments:
@param [in] host Name of the host to connect to
@param [in, out] opt_protocol Location of the protocol option
variable to update
@param [in] new_protocol New protocol to force
*/
static inline void warn_protocol_override(char *host,
uint *opt_protocol,
uint new_protocol)
{
DBUG_ASSERT(new_protocol == MYSQL_PROTOCOL_TCP
|| new_protocol == SOCKET_PROTOCOL_TO_FORCE);
if ((host == NULL
|| strncmp(host, LOCAL_HOST, sizeof(LOCAL_HOST)-1) == 0))
{
const char *protocol_name;
if (*opt_protocol == MYSQL_PROTOCOL_DEFAULT
#ifndef _WIN32
&& new_protocol == MYSQL_PROTOCOL_SOCKET
#else
&& new_protocol == MYSQL_PROTOCOL_TCP
#endif
)
{
/* This is already the default behavior, do nothing */
return;
}
protocol_name= sql_protocol_typelib.type_names[new_protocol-1];
fprintf(stderr, "%s %s %s\n",
"WARNING: Forcing protocol to ",
protocol_name,
" due to option specification. "
"Please explicitly state intended protocol.");
*opt_protocol = new_protocol;
}
}
...@@ -206,6 +206,8 @@ static uint opt_protocol=0; ...@@ -206,6 +206,8 @@ static uint opt_protocol=0;
static const char *opt_protocol_type= ""; static const char *opt_protocol_type= "";
static CHARSET_INFO *charset_info= &my_charset_latin1; static CHARSET_INFO *charset_info= &my_charset_latin1;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#include "sslopt-vars.h" #include "sslopt-vars.h"
const char *default_dbug_option="d:t:o,/tmp/mariadb.trace"; const char *default_dbug_option="d:t:o,/tmp/mariadb.trace";
...@@ -1162,6 +1164,9 @@ int main(int argc,char *argv[]) ...@@ -1162,6 +1164,9 @@ int main(int argc,char *argv[])
close(stdout_fileno_copy); /* Clean up dup(). */ close(stdout_fileno_copy); /* Clean up dup(). */
} }
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv; defaults_argv=argv;
if ((status.exit_status= get_options(argc, (char **) argv))) if ((status.exit_status= get_options(argc, (char **) argv)))
...@@ -1171,6 +1176,14 @@ int main(int argc,char *argv[]) ...@@ -1171,6 +1176,14 @@ int main(int argc,char *argv[])
exit(status.exit_status); exit(status.exit_status);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
if (status.batch && !status.line_buff && if (status.batch && !status.line_buff &&
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
{ {
...@@ -1715,8 +1728,11 @@ static void usage(int version) ...@@ -1715,8 +1728,11 @@ static void usage(int version)
my_bool my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *filename)
{ {
/* Track when protocol is set via CLI to not force port TCP protocol override */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
strmake_buf(mysql_charsets_dir, argument); strmake_buf(mysql_charsets_dir, argument);
...@@ -1781,6 +1797,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -1781,6 +1797,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
opt->name)) <= 0) opt->name)) <= 0)
exit(1); exit(1);
#endif #endif
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case OPT_SERVER_ARG: case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
...@@ -1872,6 +1896,13 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -1872,6 +1896,13 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_protocol_type= "pipe"; opt_protocol_type= "pipe";
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
#include <sslopt-case.h> #include <sslopt-case.h>
...@@ -1883,6 +1914,38 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -1883,6 +1914,38 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
status.exit_status= 0; status.exit_status= 0;
mysql_end(-1); mysql_end(-1);
break; break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break;
case 'I': case 'I':
case '?': case '?':
usage(0); usage(0);
......
...@@ -54,6 +54,8 @@ static bool sql_log_bin_off= false; ...@@ -54,6 +54,8 @@ static bool sql_log_bin_off= false;
static uint opt_protocol=0; static uint opt_protocol=0;
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */ static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
/* /*
When using extended-status relatively, ex_val_max_len is the estimated When using extended-status relatively, ex_val_max_len is the estimated
maximum length for any relative value printed by extended-status. The maximum length for any relative value printed by extended-status. The
...@@ -241,8 +243,12 @@ static const char *load_default_groups[]= ...@@ -241,8 +243,12 @@ static const char *load_default_groups[]=
0 }; 0 };
my_bool my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'c': case 'c':
opt_count_iterations= 1; opt_count_iterations= 1;
...@@ -274,6 +280,13 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -274,6 +280,13 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case '#': case '#':
...@@ -309,6 +322,46 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -309,6 +322,46 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break; break;
} }
return 0; return 0;
...@@ -323,6 +376,10 @@ int main(int argc,char *argv[]) ...@@ -323,6 +376,10 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
save_argv = argv; /* Save for free_defaults */ save_argv = argv; /* Save for free_defaults */
...@@ -331,6 +388,13 @@ int main(int argc,char *argv[]) ...@@ -331,6 +388,13 @@ int main(int argc,char *argv[])
temp_argv= mask_password(argc, &argv); temp_argv= mask_password(argc, &argv);
temp_argc= argc; temp_argc= argc;
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag) if (debug_check_flag)
......
...@@ -98,6 +98,8 @@ static const char *output_prefix= ""; ...@@ -98,6 +98,8 @@ static const char *output_prefix= "";
static char **defaults_argv= 0; static char **defaults_argv= 0;
static MEM_ROOT glob_root; static MEM_ROOT glob_root;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#ifndef DBUG_OFF #ifndef DBUG_OFF
static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace"; static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace";
const char *current_dbug_option= default_dbug_option; const char *current_dbug_option= default_dbug_option;
...@@ -1959,9 +1961,13 @@ static my_time_t convert_str_to_timestamp(const char* str) ...@@ -1959,9 +1961,13 @@ static my_time_t convert_str_to_timestamp(const char* str)
extern "C" my_bool extern "C" my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *filename)
{ {
bool tty_password=0; bool tty_password=0;
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch (opt->id) { switch (opt->id) {
#ifndef DBUG_OFF #ifndef DBUG_OFF
case '#': case '#':
...@@ -2011,6 +2017,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -2011,6 +2017,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
die(); die();
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
#ifdef WHEN_FLASHBACK_REVIEW_READY #ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review: case opt_flashback_review:
...@@ -2092,6 +2106,38 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) ...@@ -2092,6 +2106,38 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
case OPT_PRINT_ROW_EVENT_POSITIONS: case OPT_PRINT_ROW_EVENT_POSITIONS:
print_row_event_positions_used= 1; print_row_event_positions_used= 1;
break; break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break;
case 'v': case 'v':
if (argument == disabled_my_option) if (argument == disabled_my_option)
verbose= 0; verbose= 0;
...@@ -3049,6 +3095,9 @@ int main(int argc, char** argv) ...@@ -3049,6 +3095,9 @@ int main(int argc, char** argv)
my_init_time(); // for time functions my_init_time(); // for time functions
tzset(); // set tzname tzset(); // set tzname
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_groups, &argc, &argv); load_defaults_or_exit("my", load_groups, &argc, &argv);
defaults_argv= argv; defaults_argv= argv;
...@@ -3062,6 +3111,13 @@ int main(int argc, char** argv) ...@@ -3062,6 +3111,13 @@ int main(int argc, char** argv)
parse_args(&argc, (char***)&argv); parse_args(&argc, (char***)&argv);
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
if (!argc || opt_version) if (!argc || opt_version)
{ {
if (!opt_version) if (!opt_version)
......
...@@ -57,6 +57,8 @@ DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; ...@@ -57,6 +57,8 @@ DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
DYNAMIC_ARRAY views4repair; DYNAMIC_ARRAY views4repair;
static uint opt_protocol=0; static uint opt_protocol=0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES }; enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES };
const char *operation_name[]= const char *operation_name[]=
{ {
...@@ -286,9 +288,13 @@ static void usage(void) ...@@ -286,9 +288,13 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
const char *argument, const char *argument,
const char *filename __attribute__((unused))) const char *filename)
{ {
int orig_what_to_do= what_to_do; int orig_what_to_do= what_to_do;
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch(opt->id) { switch(opt->id) {
...@@ -351,6 +357,13 @@ get_one_option(const struct my_option *opt, ...@@ -351,6 +357,13 @@ get_one_option(const struct my_option *opt,
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case '#': case '#':
...@@ -374,6 +387,46 @@ get_one_option(const struct my_option *opt, ...@@ -374,6 +387,46 @@ get_one_option(const struct my_option *opt,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break; break;
} }
...@@ -1179,6 +1232,10 @@ int main(int argc, char **argv) ...@@ -1179,6 +1232,10 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
/* /*
** Check out the args ** Check out the args
*/ */
...@@ -1186,6 +1243,15 @@ int main(int argc, char **argv) ...@@ -1186,6 +1243,15 @@ int main(int argc, char **argv)
defaults_argv= argv; defaults_argv= argv;
if (get_options(&argc, &argv)) if (get_options(&argc, &argv))
goto end1; goto end1;
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
ret= EX_MYSQLERR; ret= EX_MYSQLERR;
......
...@@ -192,6 +192,8 @@ FILE *stderror_file=0; ...@@ -192,6 +192,8 @@ FILE *stderror_file=0;
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
/* /*
Dynamic_string wrapper functions. In this file use these Dynamic_string wrapper functions. In this file use these
wrappers, they will terminate the process if there is wrappers, they will terminate the process if there is
...@@ -860,8 +862,12 @@ uchar* get_table_key(const char *entry, size_t *length, ...@@ -860,8 +862,12 @@ uchar* get_table_key(const char *entry, size_t *length,
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
const char *argument, const char *argument,
const char *filename __attribute__((unused))) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch (opt->id) { switch (opt->id) {
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
...@@ -892,6 +898,13 @@ get_one_option(const struct my_option *opt, ...@@ -892,6 +898,13 @@ get_one_option(const struct my_option *opt,
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol= MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case 'N': case 'N':
...@@ -1042,11 +1055,51 @@ get_one_option(const struct my_option *opt, ...@@ -1042,11 +1055,51 @@ get_one_option(const struct my_option *opt,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case (int) OPT_DEFAULT_CHARSET: case (int) OPT_DEFAULT_CHARSET:
if (default_charset == disabled_my_option) if (default_charset == disabled_my_option)
default_charset= (char *)mysql_universal_client_charset; default_charset= (char *)mysql_universal_client_charset;
break; break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break;
} }
return 0; return 0;
} }
...@@ -1059,6 +1112,9 @@ static int get_options(int *argc, char ***argv) ...@@ -1059,6 +1112,9 @@ static int get_options(int *argc, char ***argv)
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
opt_net_buffer_length= *mysql_params->p_net_buffer_length; opt_net_buffer_length= *mysql_params->p_net_buffer_length;
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
md_result_file= stdout; md_result_file= stdout;
load_defaults_or_exit("my", load_default_groups, argc, argv); load_defaults_or_exit("my", load_default_groups, argc, argv);
defaults_argv= *argv; defaults_argv= *argv;
...@@ -1089,6 +1145,16 @@ static int get_options(int *argc, char ***argv) ...@@ -1089,6 +1145,16 @@ static int get_options(int *argc, char ***argv)
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option))) if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
return(ho_error); return(ho_error);
/*
Command line options override configured protocol
*/
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
/* /*
Dumping under --system=stats with --replace or --inser-ignore is safe and will not Dumping under --system=stats with --replace or --inser-ignore is safe and will not
retult into race condition. Otherwise dump only structure and ignore data by default retult into race condition. Otherwise dump only structure and ignore data by default
......
...@@ -63,6 +63,9 @@ static uint opt_mysql_port= 0, opt_protocol= 0; ...@@ -63,6 +63,9 @@ static uint opt_mysql_port= 0, opt_protocol= 0;
static char * opt_mysql_unix_port=0; static char * opt_mysql_unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static longlong opt_ignore_lines= -1; static longlong opt_ignore_lines= -1;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#include <sslopt-vars.h> #include <sslopt-vars.h>
static char **argv_to_free; static char **argv_to_free;
...@@ -222,8 +225,11 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); ...@@ -222,8 +225,11 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");
static my_bool static my_bool
get_one_option(const struct my_option *opt, const char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
...@@ -250,6 +256,14 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -250,6 +256,14 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_local_file=1; opt_local_file=1;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
#endif #endif
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
...@@ -259,6 +273,46 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -259,6 +273,46 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");
...@@ -645,6 +699,9 @@ int main(int argc, char **argv) ...@@ -645,6 +699,9 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
/* argv is changed in the program */ /* argv is changed in the program */
argv_to_free= argv; argv_to_free= argv;
...@@ -653,6 +710,14 @@ int main(int argc, char **argv) ...@@ -653,6 +710,14 @@ int main(int argc, char **argv)
free_defaults(argv_to_free); free_defaults(argv_to_free);
return(1); return(1);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)
......
...@@ -41,6 +41,8 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0; ...@@ -41,6 +41,8 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static uint opt_protocol=0; static uint opt_protocol=0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
static void get_options(int *argc,char ***argv); static void get_options(int *argc,char ***argv);
static uint opt_mysql_port=0; static uint opt_mysql_port=0;
static int list_dbs(MYSQL *mysql,const char *wild); static int list_dbs(MYSQL *mysql,const char *wild);
...@@ -70,11 +72,23 @@ int main(int argc, char **argv) ...@@ -70,11 +72,23 @@ int main(int argc, char **argv)
static char **defaults_argv; static char **defaults_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv; defaults_argv=argv;
get_options(&argc,&argv); get_options(&argc,&argv);
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
wild=0; wild=0;
if (argc) if (argc)
...@@ -290,8 +304,12 @@ are shown."); ...@@ -290,8 +304,12 @@ are shown.");
static my_bool static my_bool
get_one_option(const struct my_option *opt, const char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'v': case 'v':
opt_verbose++; opt_verbose++;
...@@ -320,6 +338,13 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -320,6 +338,13 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
...@@ -329,6 +354,46 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -329,6 +354,46 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");
......
...@@ -173,6 +173,8 @@ File csv_file; ...@@ -173,6 +173,8 @@ File csv_file;
static uint opt_protocol= 0; static uint opt_protocol= 0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
static int get_options(int *argc,char ***argv); static int get_options(int *argc,char ***argv);
static uint opt_mysql_port= 0; static uint opt_mysql_port= 0;
...@@ -319,6 +321,9 @@ int main(int argc, char **argv) ...@@ -319,6 +321,9 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* We need to know if protocol-related options originate from CLI args */
my_defaults_mark_files = TRUE;
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv; defaults_argv=argv;
if (get_options(&argc,&argv)) if (get_options(&argc,&argv))
...@@ -327,6 +332,14 @@ int main(int argc, char **argv) ...@@ -327,6 +332,14 @@ int main(int argc, char **argv)
my_end(0); my_end(0);
exit(1); exit(1);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
/* Seed the random number generator if we will be using it. */ /* Seed the random number generator if we will be using it. */
...@@ -727,8 +740,11 @@ static void usage(void) ...@@ -727,8 +740,11 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, const char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch(opt->id) { switch(opt->id) {
case 'v': case 'v':
...@@ -758,6 +774,13 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -758,6 +774,13 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
#ifdef __WIN__ #ifdef __WIN__
opt_protocol= MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
...@@ -767,6 +790,46 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -767,6 +790,46 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break;
case 'P':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
}
break;
case 'S':
/* If port and socket are set, fall back to default behavior */
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
}
break; break;
case '#': case '#':
DBUG_PUSH(argument ? argument : default_dbug_option); DBUG_PUSH(argument ? argument : default_dbug_option);
......
...@@ -862,7 +862,8 @@ Directory for client-side plugins\&. ...@@ -862,7 +862,8 @@ Directory for client-side plugins\&.
\fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-\-port=\fR\fB\fIport_num\fR\fR,
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -1200,6 +1201,7 @@ Do not write line numbers for errors\&. Useful when you want to compare result f ...@@ -1200,6 +1201,7 @@ Do not write line numbers for errors\&. Useful when you want to compare result f
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -1105,6 +1105,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i ...@@ -1105,6 +1105,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i
.sp .sp
The TCP/IP port number to use for the connection or 0 for default to, The TCP/IP port number to use for the connection or 0 for default to,
in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -1227,6 +1228,7 @@ executes commands indefinitely until interrupted\&. ...@@ -1227,6 +1228,7 @@ executes commands indefinitely until interrupted\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -791,6 +791,7 @@ Print the program argument list from all option files and exit\&. ...@@ -791,6 +791,7 @@ Print the program argument list from all option files and exit\&.
The TCP/IP port number to use for connecting to a remote server, The TCP/IP port number to use for connecting to a remote server,
or \fB0\fR for default to, in order of preference, \fBmy.cnf\fR, or \fB0\fR for default to, in order of preference, \fBmy.cnf\fR,
\fB$MYSQL_TCP_PORT\fR, \fB/etc/services\fR, \fRbuilt-in default (3306)\fR\&. \fB$MYSQL_TCP_PORT\fR, \fB/etc/services\fR, \fRbuilt-in default (3306)\fR\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -955,6 +956,7 @@ base64-output, consider using \fB--base64-output=never\fR instead\&. ...@@ -955,6 +956,7 @@ base64-output, consider using \fB--base64-output=never\fR instead\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -731,6 +731,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i ...@@ -731,6 +731,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection\&. The TCP/IP port number to use for the connection\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -874,6 +875,7 @@ Don't process the database (case-sensitive) specified as argument\&. ...@@ -874,6 +875,7 @@ Don't process the database (case-sensitive) specified as argument\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -1614,6 +1614,7 @@ Directory for client-side plugins\&. ...@@ -1614,6 +1614,7 @@ Directory for client-side plugins\&.
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection\&. The TCP/IP port number to use for the connection\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -2056,6 +2057,7 @@ option\&. ...@@ -2056,6 +2057,7 @@ option\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -531,6 +531,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i ...@@ -531,6 +531,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection\&. The TCP/IP port number to use for the connection\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -617,6 +618,7 @@ Silent mode\&. Produce output only when errors occur\&. ...@@ -617,6 +618,7 @@ Silent mode\&. Produce output only when errors occur\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -426,6 +426,7 @@ Directory for client-side plugins\&. ...@@ -426,6 +426,7 @@ Directory for client-side plugins\&.
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection\&. The TCP/IP port number to use for the connection\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -494,6 +495,7 @@ VIEW\&. ...@@ -494,6 +495,7 @@ VIEW\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
...@@ -799,6 +799,7 @@ Directory for client-side plugins\&. ...@@ -799,6 +799,7 @@ Directory for client-side plugins\&.
\fB\-P \fR\fB\fIport_num\fR\fR \fB\-P \fR\fB\fIport_num\fR\fR
.sp .sp
The TCP/IP port number to use for the connection\&. The TCP/IP port number to use for the connection\&.
Forces --protocol=tcp when specified on the command line without other connection properties\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
...@@ -960,6 +961,7 @@ Silent mode\&. No output\&. ...@@ -960,6 +961,7 @@ Silent mode\&. No output\&.
.sp .sp
For connections to For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
Forces --protocol=socket when specified on the command line without other connection properties; on Windows, forces --protocol=pipe\&.
.RE .RE
.sp .sp
.RS 4 .RS 4
......
#
# MDEV-14974: --port ignored for --host=localhost
#
#
# The following group of tests should produce no warnings
#
# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: Localhost via UNIX socket
# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: Localhost via UNIX socket
# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: 127.0.0.1 via TCP/IP
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: Localhost via UNIX socket
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
Connection: Localhost via UNIX socket
#
# The remaining tests should produce warnings
#
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol.
Connection: localhost via TCP/IP
--echo #
--echo # MDEV-14974: --port ignored for --host=localhost
--echo #
--source include/not_embedded.inc
--source include/not_windows.inc
--echo #
--echo # The following group of tests should produce no warnings
--echo #
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
--echo #
--echo # The remaining tests should produce warnings
--echo #
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--loose-enable-named-pipe
\ No newline at end of file
#
# MDEV-14974: --port ignored for --host=localhost
#
#
# The following group of tests should produce no warnings
#
# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via named pipe
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via named pipe
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via named pipe
#
# The remaining tests should produce warnings
#
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
WARNING: Forcing protocol to PIPE due to option specification. Please explicitly state intended protocol.
Connection: localhost via named pipe
--echo #
--echo # MDEV-14974: --port ignored for --host=localhost
--echo #
--source include/not_embedded.inc
--source include/windows.inc
--echo #
--echo # The following group of tests should produce no warnings
--echo #
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo #
--echo # The remaining tests should produce warnings
--echo #
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
...@@ -15,14 +15,14 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; ...@@ -15,14 +15,14 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON `plug%dest` TO plug_user; GRANT PROXY ON `plug%dest` TO plug_user;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE PROXY ON `plug%dest` FROM plug_user; REVOKE PROXY ON `plug%dest` FROM plug_user;
GRANT PROXY ON plug_dest TO plug_user; GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE PROXY ON plug_dest FROM plug_user; REVOKE PROXY ON plug_dest FROM plug_user;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
DROP USER plug_user,plug_dest; DROP USER plug_user,plug_dest;
# #
# GRANT...WITH # GRANT...WITH
...@@ -35,15 +35,15 @@ GRANT PROXY ON plug_dest TO plug_user; ...@@ -35,15 +35,15 @@ GRANT PROXY ON plug_dest TO plug_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo 1) --echo 1)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'; REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
--echo 2) --echo 2)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE PROXY ON plug_dest FROM plug_user; REVOKE PROXY ON plug_dest FROM plug_user;
--echo 3) --echo 3)
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
DROP USER plug_user,plug_dest; DROP USER plug_user,plug_dest;
# #
# GRANT...WITH/CREATE...BY # GRANT...WITH/CREATE...BY
...@@ -52,11 +52,11 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user ...@@ -52,11 +52,11 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--echo 1) --echo 1)
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
GRANT PROXY ON plug_dest TO plug_user; GRANT PROXY ON plug_dest TO plug_user;
--echo 2) --echo 2)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'; REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
#REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest''; #REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest'';
DROP USER plug_user,plug_dest; DROP USER plug_user,plug_dest;
...@@ -69,13 +69,13 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user ...@@ -69,13 +69,13 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user; GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
RENAME USER plug_dest TO new_dest; RENAME USER plug_dest TO new_dest;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON new_dest TO plug_user; GRANT PROXY ON new_dest TO plug_user;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
--sorted_result --sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_user,new_dest; DROP USER plug_user,new_dest;
...@@ -85,16 +85,16 @@ CREATE USER plug_user ...@@ -85,16 +85,16 @@ CREATE USER plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest'; IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON plug_dest TO plug_user; GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK --replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
RENAME USER plug_dest TO new_dest; RENAME USER plug_dest TO new_dest;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON new_dest TO plug_user; GRANT PROXY ON new_dest TO plug_user;
--error 1 --error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1 --exec $MYSQL -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
--sorted_result --sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_user,new_dest; DROP USER plug_user,new_dest;
...@@ -277,13 +277,13 @@ FLUSH PRIVILEGES; ...@@ -277,13 +277,13 @@ FLUSH PRIVILEGES;
# Not working with the patch. # Not working with the patch.
#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK #--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
#--exec $MYSQLADMIN -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_user --password=plug_dest ping 2>&1 #--exec $MYSQLADMIN -h localhost -u plug_user --password=plug_dest ping 2>&1
#--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT #--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT
#--exec $MYSQL_CHECK -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test #--exec $MYSQL_CHECK -h localhost -u plug_user --password=plug_dest test
#--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT #--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT
#--exec $MYSQL_DUMP -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test #--exec $MYSQL_DUMP -h localhost -u plug_user --password=plug_dest test
#--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT #--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT
#--exec $MYSQL_SHOW -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth -u plug_user --password=plug_dest 2>&1 #--exec $MYSQL_SHOW -h localhost --plugin_dir=../plugin/auth -u plug_user --password=plug_dest 2>&1
DROP USER plug_user, plug_dest; DROP USER plug_user, plug_dest;
DROP DATABASE test_user_db; DROP DATABASE test_user_db;
--exit --exit
...@@ -16,7 +16,7 @@ NULL ...@@ -16,7 +16,7 @@ NULL
SELECT @@external_user; SELECT @@external_user;
@@external_user @@external_user
NULL NULL
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user current_user() user() @@local.proxy_user @@local.external_user
qa_test_1_user@% qa_test_1_user@localhost NULL NULL qa_test_1_user@% qa_test_1_user@localhost NULL NULL
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
...@@ -45,7 +45,7 @@ NULL ...@@ -45,7 +45,7 @@ NULL
SELECT @@external_user; SELECT @@external_user;
@@external_user @@external_user
NULL NULL
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user current_user() user() @@local.proxy_user @@local.external_user
authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
...@@ -62,7 +62,7 @@ CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest' ...@@ -62,7 +62,7 @@ CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest'
CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd'; CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user; GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user current_user() user() @@local.proxy_user @@local.external_user
qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' qa_test_3_dest qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' qa_test_3_dest
DROP USER qa_test_3_user; DROP USER qa_test_3_user;
...@@ -72,7 +72,7 @@ CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest' ...@@ -72,7 +72,7 @@ CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest'
CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd'; CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user; GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user current_user() user() @@local.proxy_user @@local.external_user
qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' qa_test_4_dest qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' qa_test_4_dest
DROP USER qa_test_4_user; DROP USER qa_test_4_user;
...@@ -91,7 +91,7 @@ User plugin authentication_string Password ...@@ -91,7 +91,7 @@ User plugin authentication_string Password
mariadb.sys mysql_native_password mariadb.sys mysql_native_password
qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_5_user qa_auth_interface qa_test_5_dest qa_test_5_user qa_auth_interface qa_test_5_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
DROP USER qa_test_5_user; DROP USER qa_test_5_user;
DROP USER qa_test_5_dest; DROP USER qa_test_5_dest;
...@@ -106,7 +106,7 @@ User plugin authentication_string Password ...@@ -106,7 +106,7 @@ User plugin authentication_string Password
mariadb.sys mysql_native_password mariadb.sys mysql_native_password
qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES)
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest'; GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
...@@ -114,7 +114,7 @@ User plugin authentication_string Password ...@@ -114,7 +114,7 @@ User plugin authentication_string Password
mariadb.sys mysql_native_password mariadb.sys mysql_native_password
qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
REVOKE PROXY ON qa_test_6_dest FROM root; REVOKE PROXY ON qa_test_6_dest FROM root;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
...@@ -122,7 +122,7 @@ User plugin authentication_string ...@@ -122,7 +122,7 @@ User plugin authentication_string
mariadb.sys mysql_native_password mariadb.sys mysql_native_password
qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
DROP USER qa_test_6_user; DROP USER qa_test_6_user;
DROP USER qa_test_6_dest; DROP USER qa_test_6_dest;
...@@ -135,7 +135,7 @@ CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_des ...@@ -135,7 +135,7 @@ CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_des
CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd'; CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user; GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_11_user'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'qa_test_11_user'@'localhost' (using password: YES)
DROP USER qa_test_11_user, qa_test_11_dest; DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db; DROP DATABASE test_user_db;
...@@ -20,8 +20,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; ...@@ -20,8 +20,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
SELECT @@proxy_user; SELECT @@proxy_user;
SELECT @@external_user; SELECT @@external_user;
--echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--sorted_result --sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
...@@ -42,8 +42,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; ...@@ -42,8 +42,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
SELECT @@proxy_user; SELECT @@proxy_user;
SELECT @@external_user; SELECT @@external_user;
--echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--sorted_result --sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
...@@ -59,8 +59,8 @@ CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd'; ...@@ -59,8 +59,8 @@ CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user; GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
--echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_3_user; DROP USER qa_test_3_user;
DROP USER qa_test_3_dest; DROP USER qa_test_3_dest;
...@@ -72,8 +72,8 @@ CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd'; ...@@ -72,8 +72,8 @@ CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user; GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
--echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_4_user; DROP USER qa_test_4_user;
DROP USER qa_test_4_dest; DROP USER qa_test_4_dest;
...@@ -91,9 +91,9 @@ GRANT PROXY ON qa_test_5_dest TO ''@'localhost'; ...@@ -91,9 +91,9 @@ GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
--sorted_result --sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
--echo exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL -h localhost -P $MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_5_user; DROP USER qa_test_5_user;
DROP USER qa_test_5_dest; DROP USER qa_test_5_dest;
...@@ -109,25 +109,25 @@ GRANT PROXY ON qa_test_6_dest TO qa_test_6_user; ...@@ -109,25 +109,25 @@ GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
--sorted_result --sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
--echo exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL -h localhost -P $MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest'; GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
--sorted_result --sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
--echo exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
REVOKE PROXY ON qa_test_6_dest FROM root; REVOKE PROXY ON qa_test_6_dest FROM root;
--sorted_result --sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL -h localhost --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_6_user; DROP USER qa_test_6_user;
DROP USER qa_test_6_dest; DROP USER qa_test_6_dest;
...@@ -143,9 +143,9 @@ CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd'; ...@@ -143,9 +143,9 @@ CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user; GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
--echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_11_user, qa_test_11_dest; DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db; DROP DATABASE test_user_db;
......
...@@ -2,10 +2,10 @@ CREATE DATABASE test_user_db; ...@@ -2,10 +2,10 @@ CREATE DATABASE test_user_db;
CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest'; CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user; GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user current_user() user() @@local.proxy_user @@local.external_user
qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' NULL qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' NULL
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: YES) ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: YES)
DROP USER qa_test_11_user, qa_test_11_dest; DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db; DROP DATABASE test_user_db;
...@@ -12,12 +12,12 @@ CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest'; ...@@ -12,12 +12,12 @@ CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user; GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
--echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --echo exec MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
--error 1 --error 1
--exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 --exec $MYSQL --default_auth=qa_auth_client -h localhost -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
DROP USER qa_test_11_user, qa_test_11_dest; DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db; DROP DATABASE test_user_db;
......
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