mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix mysql_setpermission hostname logic
Changes: - Don't include port in connection parameters with 'localhost' hostname More info: The hostname, if not specified or specified as '' or 'localhost', will default to a MySQL server running on the local machine using the default for the UNIX socket. To connect to a MySQL server on the local machine via TCP, you must specify the loopback IP address (127.0.0.1) as the host. Reported issue: https://bugzilla.redhat.com/show_bug.cgi?id=1976224
This commit is contained in:
committed by
Daniel Black
parent
ece30d47ca
commit
683f91a287
@ -52,6 +52,7 @@ use strict;
|
|||||||
use vars qw($dbh $sth $hostname $opt_user $opt_password $opt_help $opt_host
|
use vars qw($dbh $sth $hostname $opt_user $opt_password $opt_help $opt_host
|
||||||
$opt_socket $opt_port $host $version);
|
$opt_socket $opt_port $host $version);
|
||||||
|
|
||||||
|
my $sqlport = "";
|
||||||
my $sqlhost = "";
|
my $sqlhost = "";
|
||||||
my $user = "";
|
my $user = "";
|
||||||
|
|
||||||
@ -84,9 +85,13 @@ if ($opt_password eq '')
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Using port argument with 'localhost' will cause an error
|
||||||
|
if ($sqlhost ne "localhost") {
|
||||||
|
$sqlport = ":port=$opt_port";
|
||||||
|
}
|
||||||
|
|
||||||
# make the connection to MariaDB
|
# make the connection to MariaDB
|
||||||
$dbh= DBI->connect("DBI:mysql:mysql:host=$sqlhost:port=$opt_port:mysql_socket=$opt_socket",$opt_user,$opt_password, {PrintError => 0}) ||
|
$dbh= DBI->connect("DBI:mysql:mysql:host=$sqlhost$sqlport:mysql_socket=$opt_socket",$opt_user,$opt_password, {PrintError => 0}) ||
|
||||||
die("Can't make a connection to the mysql server.\n The error: $DBI::errstr");
|
die("Can't make a connection to the mysql server.\n The error: $DBI::errstr");
|
||||||
|
|
||||||
# the start of the program
|
# the start of the program
|
||||||
|
Reference in New Issue
Block a user