installshield 安装mysql数据库_InstallMySql (InstallShield script) | 学步园

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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值