配置 mysql 个实例 innosetup

configuring mysql instance innosetup

我正在尝试使用代码

配置mysql实例
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters: "--install"; 
WorkingDir: "{app}\mysql\bin";  StatusMsg: "Installing the MySQL Service";
Description: "Installing MySQL Service"; Flags: runhidden; Check: MySQL_Is;


Filename: {app}\mysql\bin\MySQLInstanceConfig.exe; 
Parameters:"-i -q ""-l{app}\mysql\mysql_install_log.txt"" ""-nMySQL Server 5.5"" ""-p{app}\mysql"" -v5.5.23 ""-t{app}\mysql\my-template.ini"" ""-c{app}\mysql\mysql.ini"" ServerType=SERVER DatabaseType=MIXED Port=3306 StrictMode=yes ConnectionCount=15 Charset=utf8 ServiceName=MYSQL AddBinToPath=yes RootPassword=mypass"; 
WorkingDir: {app}; StatusMsg: Configuring MySQL services; 
Description: Configuring MySQL Service; Flags: runhidden 



[Code]
function MySQL_Is(): Boolean;
var
iResultCode: Integer;
AppPath: String;
begin
  Result := true;
  if (not RegKeyExists(HKLM, 'SOFTWARE\MySQL AB\MySQL Server 5.5')) or 
   (not FileExists(ExpandConstant('{reg:HKLM\SOFTWARE\MySQL AB\MySQL Server 5.5,Location}\bin\mysql.exe'))) 
  then begin
     ExtractTemporaryFile('mysql-5.5.11-win32.msi');
     AppPath := ExpandConstant('{app}')
     Exec('msiexec.exe', '/i mysql-5.5.11-win32.msi /qn INSTALLDIR="' + AppPath + '\mysql"  DATADIR="' + AppPath + 'mysql\data"', 
      ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated, iResultCode);
         if not FileExists(ExpandConstant('{reg:HKLM\SOFTWARE\MySQL AB\MySQL Server 5.5,Location}\bin\mysql.exe')) then begin
            MsgBox('Something went wrong! Installation should be terminated' + AppPath, 
              mbInformation, MB_OK);
            Result := false;
         end;
  end;
end;

我在调试器中收到以下错误

[15:35:46.583] Type: Exec [15:35:46.588] Filename: C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\bin\MySQLInstanceConfig.exe [15:35:46.592] Parameters: -i -q "-lC:\Program Files (x86)\MyCompany Inc\MyApp\mysql\mysql_install_log.txt" "-nMySQL Server 5.5" "-pC:\Program Files (x86)\MyCompany Inc\MyApp\mysql" -v5.5.23 "-tC:\Program Files (x86)\MyCompany Inc\MyApp\mysql\my-template.ini" "-cC:\Program Files (x86)\MyCompany Inc\MyApp\mysql\mysql.ini" ServerType=SERVER DatabaseType=MIXED Port=3306 StrictMode=yes ConnectionCount=15 Charset=utf8 ServiceName=MYSQL AddBinToPath=yes RootPassword=mypass [15:36:12.122] Process exit code: 3

这是配置执行期间创建的日志文件

---------------------------------------- Welcome to the MySQL Server Instance Configuration Wizard 1.0.17.0 Date: 2016-09-02 15:35:49

Installing service ...

Product Name: MySQL Server 5.5 Version: 5.5.23 Installation Path: C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\

Creating configuration file C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\mysql.ini using template C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\my-template.ini. Options: SERVER MIXED STRICTMODE

Variables: active_connections: 15 port: 3306 default-character-set: utf8 basedir: "C:/Program Files (x86)/MyCompany Inc/MyApp/mysql/" datadir: "C:/Program Files (x86)/MyCompany Inc/MyApp/mysql/Data/"

Creating Windows service entry. Service name: "MYSQL" Parameters:
"C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\bin\mysqld" --defaults-file="C:\Program Files (x86)\MyCompany Inc\MyApp\mysql\mysql.ini" MYSQL. Cannot create Windows service for MYSQL. Error: 0

可能是什么原因?

我找到了问题的解决方案,

首先我检查了事件查看器,发现 MySql 服务出现错误 unknown/unsupported storage engine innodb 所以我在网上搜索了解决方案

事实证明,mysql\data 目录中的两个日志文件 ib_logfile0, ib_logfile1 是罪魁祸首

我在卸载 MySql 和 运行 我的应用程序设置后再次删除了它们 运行 成功