Skip to content

Commit

Permalink
Merge pull request #731 from leonyu/master
Browse files Browse the repository at this point in the history
Only pass `-P` for socket connection when port option is specified
  • Loading branch information
jmrenouard authored Sep 25, 2023
2 parents 835a181 + 46af11a commit 9d44e4c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 '' ) {
Expand All @@ -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 ) {
Expand Down

0 comments on commit 9d44e4c

Please sign in to comment.