function InstallMySql(hMSI)
string sTmp;
string sSupportDir;
string sOldDir;
int nLength;
begin
nLength = MAX_PATH;
MsiGetProperty(hMSI, "SUPPORTDIR", sSupportDir, nLength);
GetCurrentDir(sOldDir);
ChangeDirectory(sSupportDir);
SdShowMsg("Installing MySql 5.1.40...", TRUE);
sTmp = "/i /"mysql-5.1.40.msi/" /qn INSTALLDIR=/"C://Program Files//MySQL//MySQL Server 5.1/" DATADIR=/"C://Program Files//MySQL//MySQL Server 5.1//Data/" /L* /"";
sTmp = sTmp + INSTALLDIR;
sTmp = sTmp + "mysql-log.txt/" ";
//LaunchAppAndWait("msiexec.exe", sTmp, WAIT);
sTmp = sSupportDir ^ "my.ini";
//nLength = CopyFile(sTmp, "/"C://Program Files//MySQL//MySQL Server 5.1//my.ini/"");
nLength = CopyFile(sTmp, "g://my.ini");
sTmp = FormatMessage(nLength);
ChangeDirectory("C://Program Files//MySQL//MySQL Server 5.1");
//LaunchAppAndWait(
//mysqld --defaults-file="C:/Program Files/MySQL/MySQL Server X.Y/my.ini"
SdShowMsg("", FALSE);
/*
首先使用update把mysql.user中的root的host从localhost修改成%:
mysql>; UPDATE mysql.user SET Host='%' WHERE Host='localhost'
mysql>; GRANT ALL PRIVILEGES ON *.* TO root@"%"
mysql>; FLUSH PRIVILEGES ;
*/
ChangeDirectory(sOldDir);
//sMsiFile = sMsiFile ^ "New Text Document.txt";
//sMsiFile = sMsiFile ^ "mysql-essential-5.1.40-win32.msi";
//sParam = "";
///q /log install.txt /i mysql-advanced-5.1.32-win32.msi datadir=”c:/installs/myapp” installdir=”c:/installs/myapp”
//LaunchAppAndWait("notepad.exe", sMsiFile, WAIT);
end;
InstallMySql (InstallShield script)
最新推荐文章于 2021-02-17 16:47:36 发布