summaryrefslogtreecommitdiff
path: root/sql/ha_federated.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r--sql/ha_federated.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index c0743bd6c9a..a5e4714c53a 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -643,12 +643,19 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
if ((strchr(share->table_name, '/')))
goto error;
+ /*
+ If hostname is omitted, we set it to NULL. According to
+ mysql_real_connect() manual:
+ The value of host may be either a hostname or an IP address.
+ If host is NULL or the string "localhost", a connection to the
+ local host is assumed.
+ */
if (share->hostname[0] == '\0')
share->hostname= NULL;
if (!share->port)
{
- if (strcmp(share->hostname, my_localhost) == 0)
+ if (!share->hostname || strcmp(share->hostname, my_localhost) == 0)
share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0));
else
share->port= MYSQL_PORT;