summaryrefslogtreecommitdiff
path: root/sql/mysql_install_db.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-01-04 23:04:37 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2017-01-06 16:25:25 +0100
commitae6eb7a0020eb4d51f97f924e5320325e5b63934 (patch)
tree86eaa0f741228ed5aa4d9567870970d6b22dc2dd /sql/mysql_install_db.cc
parente4978d26b79120c58706e57fc66e4de1ec4b230c (diff)
downloadmariadb-git-ae6eb7a0020eb4d51f97f924e5320325e5b63934.tar.gz
MDEV-11088 Client plugins cannot be loaded by command line tools
in default installation. Added plugin-dir to the [client] section of the generated my.ini, so that installed services (MSI or mysql_install_db.exe) would be able to find plugin directory.
Diffstat (limited to 'sql/mysql_install_db.cc')
-rw-r--r--sql/mysql_install_db.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index c39789f7c97..c23a20ebac9 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -233,6 +233,20 @@ static void get_basedir(char *basedir, int size, const char *mysqld_path)
}
}
+#define STR(s) _STR(s)
+#define _STR(s) #s
+
+static char *get_plugindir()
+{
+ static char plugin_dir[2*MAX_PATH];
+ get_basedir(plugin_dir, sizeof(plugin_dir), mysqld_path);
+ strcat(plugin_dir, "/" STR(INSTALL_PLUGINDIR));
+
+ if (access(plugin_dir, 0) == 0)
+ return plugin_dir;
+
+ return NULL;
+}
/**
Allocate and initialize command line for mysqld --bootstrap.
@@ -313,6 +327,10 @@ static int create_myini()
fprintf(myini,"protocol=pipe\n");
else if (opt_port)
fprintf(myini,"port=%d\n",opt_port);
+
+ char *plugin_dir = get_plugindir();
+ if (plugin_dir)
+ fprintf(myini, "plugin-dir=%s\n", plugin_dir);
fclose(myini);
return 0;
}