//初始化MySQL
WizardForm.StatusLabel.Caption := 'initializing server...';
ShellExec('open', ExpandConstant('{app}\...\MySQL\bin\mysqld.exe'), '--initialize-insecure --console', ExpandConstant('{app}\...\MySQL\bin\'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
...
//安装MySQL服务
WizardForm.StatusLabel.Caption := 'installing server...';
ShellExec('open', ExpandConstant('{app}\...\MySQL\bin\mysqld.exe'), '--install', ExpandConstant('{app}\...\MySQL\bin\'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
...
//启动MySQL服务
WizardForm.StatusLabel.Caption := 'starting server...';
ShellExec('open', ExpandConstant('net.exe'), 'start MySQL', ExpandConstant(''), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
...
//检测服务是否启动
...
//设置密码
ShellExec('open', ExpandConstant('{app}\...\MySQL\bin\mysqladmin.exe'), '-u root password xxxxx', ExpandConstant('{app}\...\MySQL\bin\'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
//创建数据库、表
WizardForm.StatusLabel.Caption := 'creating DB...';
ShellExec('open', ExpandConstant('{app}\...\db_install.bat'), '', ExpandConstant('{app}\...'), SW_HIDE, ewWaitUntilTerminated, ErrorCode);
Inno Setup 安装启动MySQL8.0服务关键脚本
最新推荐文章于 2024-02-26 16:12:01 发布