summaryrefslogtreecommitdiff
path: root/sql/mysql_install_db.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/mysql_install_db.cc')
-rw-r--r--sql/mysql_install_db.cc61
1 files changed, 47 insertions, 14 deletions
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index b757ce8c151..c6912e41f6e 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -24,7 +24,6 @@
#include <m_string.h>
#include <windows.h>
-#include <assert.h>
#include <shellapi.h>
#include <accctrl.h>
#include <aclapi.h>
@@ -39,7 +38,7 @@ struct IUnknown;
"Usage: mysql_install_db.exe [OPTIONS]\n" \
"OPTIONS:"
-extern "C" const char mysql_bootstrap_sql[];
+extern "C" const char* mysql_bootstrap_sql[];
char default_os_user[]= "NT AUTHORITY\\NetworkService";
static int create_db_instance();
@@ -122,10 +121,10 @@ static void die(const char *fmt, ...)
if (verbose_errors)
{
fprintf(stderr,
- "http://kb.askmonty.org/v/installation-issues-on-windows contains some help\n"
+ "https://mariadb.com/kb/en/installation-issues-on-windows contains some help\n"
"for solving the most common problems. If this doesn't help you, please\n"
- "leave a comment in the Knowledgebase or file a bug report at\n"
- "http://mariadb.org/jira");
+ "leave a comment in the Knowledge Base or file a bug report at\n"
+ "https://jira.mariadb.org");
}
fflush(stderr);
va_end(args);
@@ -198,7 +197,7 @@ int main(int argc, char **argv)
die("database creation failed");
}
- printf("Creation of the database was successfull");
+ printf("Creation of the database was successful");
return 0;
}
@@ -236,6 +235,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.
@@ -252,7 +265,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
"\"\"%s\" --no-defaults %s --bootstrap"
" \"--lc-messages-dir=%s/share\""
" --basedir=. --datadir=. --default-storage-engine=myisam"
- " --max_allowed_packet=9M --loose-skip-innodb"
+ " --max_allowed_packet=9M "
" --net-buffer-length=16k\"", mysqld_path,
opt_verbose_bootstrap?"--console":"", basedir );
return cmdline;
@@ -316,6 +329,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;
}
@@ -371,8 +388,8 @@ static int register_service()
CloseServiceHandle(sc_manager);
die("CreateService failed (%u)", GetLastError());
}
-
- SERVICE_DESCRIPTION sd= { "MariaDB database server" };
+ char description[] = "MariaDB database server";
+ SERVICE_DESCRIPTION sd= { description };
ChangeServiceConfig2(sc_service, SERVICE_CONFIG_DESCRIPTION, &sd);
CloseServiceHandle(sc_service);
CloseServiceHandle(sc_manager);
@@ -624,6 +641,10 @@ static int create_db_instance()
if (!in)
goto end;
+ if (setvbuf(in, NULL, _IONBF, 0))
+ {
+ verbose("WARNING: Cannot disable buffering on mysqld's stdin");
+ }
if (fwrite("use mysql;\n",11,1, in) != 1)
{
verbose("ERROR: Cannot write to mysqld's stdin");
@@ -631,12 +652,16 @@ static int create_db_instance()
goto end;
}
- /* Write the bootstrap script to stdin. */
- if (fwrite(mysql_bootstrap_sql, strlen(mysql_bootstrap_sql), 1, in) != 1)
+ int i;
+ for (i=0; mysql_bootstrap_sql[i]; i++)
{
- verbose("ERROR: Cannot write to mysqld's stdin");
- ret= 1;
- goto end;
+ /* Write the bootstrap script to stdin. */
+ if (fwrite(mysql_bootstrap_sql[i], strlen(mysql_bootstrap_sql[i]), 1, in) != 1)
+ {
+ verbose("ERROR: Cannot write to mysqld's stdin");
+ ret= 1;
+ goto end;
+ }
}
/* Remove default user, if requested. */
@@ -687,6 +712,14 @@ static int create_db_instance()
goto end;
}
+ /*
+ Remove innodb log files if they exist (this works around "different size logs"
+ error in MSI installation). TODO : remove this with the next Innodb, where
+ different size is handled gracefully.
+ */
+ DeleteFile("ib_logfile0");
+ DeleteFile("ib_logfile1");
+
/* Create my.ini file in data directory.*/
ret= create_myini();
if (ret)