如何在inno设置中静默安装mysql?

gab*_*lia 4 java mysql inno-setup

我会为我的java应用程序创建一个安装程序.它使用mysql数据库,所以我的程序的安装必须包括安装mysql server 5.5,配置服务器和加载我的数据库.我使用Inno设置这样做但我发现了一些问题.我找到了这段代码,但它有点旧了

Filename: msiexec; Parameters: "/i mysql-5.5.11-win32.msi /qn INSTALLDIR=""C:\mysql"""; WorkingDir: C:\Users\Gabriele\Desktop\setup; StatusMsg: Sto installando Mysql 5.5.11;  Flags: runhidden

Filename: C:\mysql\bin\mysqld-nt.exe; Parameters: --install; WorkingDir: C:\mysql\bin; StatusMsg: Sto installando il Servizio MySQL; Description: Installing MySQL Service; Flags: runhidden

Filename: net.exe; Parameters: start mysql; StatusMsg: Sto Avviando il Servizio MySQL; Description: Avvio Servizio MySQL; Flags: runhidden


Filename: C:\mysql\bin\mysql.exe; Parameters: "-e ""insert into mysql.user(host,user,password) values ('localhost','root', PASSWORD('emmaus');"" -u root"; WorkingDir: {tmp}; StatusMsg: Configurazione del Server della Base di Dati; Flags: runhidden

Filename: C:\mysql\bin\mysql.exe; Parameters: "-u root -h localhost -e ""create database ata";

Filename: C:\mysql\bin\mysql.exe; Parameters: "-e ""grant all privileges on ata.* to ata;"" -u root"; WorkingDir: {tmp}; StatusMsg: Configurazione Server Base di Dati; Flags: runhidden


Filename: C:\mysql\bin\mysql.exe; Parameters: "-e ""flush privileges;"" -u root"; WorkingDir: {tmp}; StatusMsg: Configurazione Server Base di Dati; Flags: runhidden


Filename: C:\mysql\bin\mysql.exe; Parameters: "-u root -h localhost -e ""use ata; source ata.sql;"; WorkingDir: {tmp}; StatusMsg: Caricamento base di dati; Flags: runhidden  
Run Code Online (Sandbox Code Playgroud)

当我调试它在第一个语句后生成错误.在第二条指令中找不到指定的程序.我尝试使用mysqld而不是mysqld-nt,但没有任何改变

有人能帮我吗??

Rob*_*beN 8

[Files]
Source: "J:\mysql-5.5.11-win32.msi"; DestDir: "{tmp}"; Flags: nocompression dontcopy

[Run]
Filename: "{reg:HKLM\SOFTWARE\MySQL AB\MySQL Server 5.5,Location}\bin\mysqld.exe"; 
  Parameters: "--install"; WorkingDir: "{reg:HKLM\SOFTWARE\MySQL AB\MySQL Server 5.5,Location}\bin"; 
  StatusMsg: "Sto installando il Servizio MySQL"; 
  Description: "Installing MySQL Service"; 
  Flags: runhidden; Check: MySQL_Is
;//and the rest of commands

[Code]
function MySQL_Is(): Boolean;
var
iResultCode: Integer;
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');
     Exec('msiexec.exe', '/i mysql-5.5.11-win32.msi /qn INSTALLDIR="C:\mysql"', 
      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', 
              mbInformation, MB_OK);
            Result := false;
         end;
  end;
end;
Run Code Online (Sandbox Code Playgroud)