title: configuring mysql instance innosetup
body: <p>I am trying to configure mysql instance using the code</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>I get the following error in the debugger</p>
  
  <blockquote>
    <p>[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</p>
  </blockquote>
  
  <p>This is the log file created during execution of the configuration</p>
  
  <blockquote>
    <p>---------------------------------------- Welcome to the MySQL Server Instance Configuration Wizard 1.0.17.0 Date: 2016-09-02 15:35:49</p>
    
    <p>Installing service ...</p>
    
    <p>Product Name:         MySQL Server 5.5 Version:              5.5.23
    Installation Path:    C:\Program Files (x86)\MyCompany
    Inc\MyApp\mysql\</p>
    
    <p>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</p>
    
    <p>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/"</p>
    
    <p>Creating Windows service entry. Service name: "MYSQL" Parameters:<br>
    "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</p>
  </blockquote>
  
  <p>What could be the cause?</p>