summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kulik <mkulik@redhat.com>2021-08-25 17:41:43 +1000
committerDaniel Black <daniel@mariadb.org>2021-08-25 18:46:36 +1000
commit6679581d66d9202ef93264881a78e4a3ebcc4e68 (patch)
tree10727cbd0d70388cc3a7bfb9fd97f77b76f77ec2
parenta6621867e93d310742692bce4d332309999076f8 (diff)
downloadmariadb-git-bb-10.5-MDEV-26474-mysql_setpermission-hostname.tar.gz
MDEV-26474: Fix mysql_setpermission hostname logicbb-10.5-MDEV-26474-mysql_setpermission-hostname
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. To comply with what the perl module expects, we omit the port for a host=localhost connection. Reported issue: https://bugzilla.redhat.com/show_bug.cgi?id=1976224
-rw-r--r--scripts/mysql_setpermission.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 29311b9c101..6f0ad72c1d9 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -105,11 +105,15 @@ else {
if ($opt_socket and -S $opt_socket)
{
- $dsn .= "${prefix}_socket=$opt_socket";
+ $dsn .= "${prefix}_socket=$opt_socket";
}
else
{
- $dsn .= "host=$sqlhost;port=$opt_port";
+ $dsn .= "host=$sqlhost";
+ if ($sqlhost ne "localhost")
+ {
+ $dsn .= ";port=$opt_port";
+ }
}
# make the connection to MariaDB