1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MWL#55: Handle cases where service was installed with

mysqld --install without any parameters.

In such case, service name is always MYSQL, as service
binary path is "path\to\mysqld.exe" "MySQL". Guess data
directory it is either from my.ini (which  is assumed to
be in the installation root), or just data directory 
under install root.
This commit is contained in:
Vladislav Vaintroub
2011-02-04 12:20:41 +01:00
parent edf9757cb8
commit 614a6dfcd4
2 changed files with 101 additions and 14 deletions

View File

@ -36,8 +36,8 @@
#pragma comment(lib, "version")
#define USAGETEXT \
"mysql_upgrade_service.exe Ver 1.42 for Windows\n" \
"This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" \
"mysql_upgrade_service.exe Ver 1.42 for Windows\n" \
"This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" \
"and you are welcome to modify and redistribute it under the GPL v2 license\n" \
"Usage: mysql_upgrade_service.exe [OPTIONS]\n" \
"OPTIONS:"
@ -371,6 +371,30 @@ static void change_service_config()
my_major, my_minor);
}
if(props.inifile[0] == 0)
{
/*
Weird case, no --defaults-file in service definition, need to create one.
*/
char buf[MAX_PATH];
int i;
sprintf_s(props.inifile, MAX_PATH, "%s\\my.ini", props.datadir);
/*
Write datadir to my.ini, after converting backslashes to
unix style slashes.
*/
strcpy_s(buf, MAX_PATH, props.datadir);
for(i=0; buf[i]; i++)
{
if (buf[i] == '\\')
buf[i]= '/';
}
WritePrivateProfileString("mysqld", "datadir",buf, props.inifile);
}
/*
Remove basedir from defaults file, otherwise the service wont come up in
the new version, and will complain about mismatched message file.