Skip to content

Commit bd3eb52

Browse files
mkulik-rhgrooverdan
authored andcommitted
MDEV-26474: 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. 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
1 parent 1b2acc5 commit bd3eb52

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/mysql_setpermission.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ else {
105105

106106
if ($opt_socket and -S $opt_socket)
107107
{
108-
$dsn .= "${prefix}_socket=$opt_socket";
108+
$dsn .= "${prefix}_socket=$opt_socket";
109109
}
110110
else
111111
{
112-
$dsn .= "host=$sqlhost;port=$opt_port";
112+
$dsn .= "host=$sqlhost";
113+
if ($sqlhost ne "localhost")
114+
{
115+
$dsn .= ";port=$opt_port";
116+
}
113117
}
114118

115119
# make the connection to MariaDB

0 commit comments

Comments
 (0)