Only pass -P
for socket connection when port option is specified
This fix implementation of `be1f4b4` for [GCP cloud-sql-proxy](https://github.com/GoogleCloudPlatform/cloud-sql-proxy), which creates multiple sockets on localhost pointing to multiple remote instances with default port.
This commit is contained in:
parent
835a181232
commit
46af11a70b
1 changed files with 6 additions and 3 deletions
|
@ -811,11 +811,13 @@ sub mysql_setup {
|
||||||
|
|
||||||
debugprint "MySQL Client: $mysqlcmd";
|
debugprint "MySQL Client: $mysqlcmd";
|
||||||
|
|
||||||
$opt{port} = ( $opt{port} eq 0 ) ? 3306 : $opt{port};
|
|
||||||
|
|
||||||
# Are we being asked to connect via a socket?
|
# Are we being asked to connect via a socket?
|
||||||
if ( $opt{socket} ne 0 ) {
|
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 '' ) {
|
if ( $opt{protocol} ne '' ) {
|
||||||
|
@ -825,6 +827,7 @@ sub mysql_setup {
|
||||||
# Are we being asked to connect to a remote server?
|
# Are we being asked to connect to a remote server?
|
||||||
if ( $opt{host} ne 0 ) {
|
if ( $opt{host} ne 0 ) {
|
||||||
chomp( $opt{host} );
|
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 we're doing a remote connection, but forcemem wasn't specified, we need to exit
|
||||||
if ( $opt{'forcemem'} eq 0 && is_remote eq 1 ) {
|
if ( $opt{'forcemem'} eq 0 && is_remote eq 1 ) {
|
||||||
|
|
Loading…
Reference in a new issue