Merge pull request #731 from leonyu/master

Only pass `-P` for socket connection when port option is specified
This commit is contained in:
Jean-Marie Renouard 2023-09-25 11:15:51 +02:00 committed by GitHub
commit 9d44e4cc34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -811,11 +811,13 @@ sub mysql_setup {
debugprint "MySQL Client: $mysqlcmd";
$opt{port} = ( $opt{port} eq 0 ) ? 3306 : $opt{port};
# Are we being asked to connect via a socket?
if ( $opt{socket} ne 0 ) {
$remotestring = " -S $opt{socket} -P $opt{port}";
if ( $opt{port} ne 0 ) {
$remotestring = " -S $opt{socket} -P $opt{port}";
} else {
$remotestring = " -S $opt{socket}";
}
}
if ( $opt{protocol} ne '' ) {
@ -825,6 +827,7 @@ sub mysql_setup {
# Are we being asked to connect to a remote server?
if ( $opt{host} ne 0 ) {
chomp( $opt{host} );
$opt{port} = ( $opt{port} eq 0 ) ? 3306 : $opt{port};
# If we're doing a remote connection, but forcemem wasn't specified, we need to exit
if ( $opt{'forcemem'} eq 0 && is_remote eq 1 ) {