Dan
Dan

Reputation: 2344

Silent install of MySQL using NSIS

I'm trying to install MySQL silently using NSIS. Right now I'm just trying to get the MySQL part down, the script is purely for installing MySQL.

The majority of the forum posts I've read are from 2009-2011, so I would imagine out of date.

So far I have this basic script:

!include MUI2.nsh
!include WordFunc.nsh
!insertmacro VersionCompare
!include LogicLib.nsh
!include InstallOptions.nsh
!include nsDialogs.nsh

Name "sqltest"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT

OutFile "sqltest.exe"
InstallDir "$PROGRAMFILES\sqltest"
RequestExecutionLevel admin

XPStyle on


!define MUI_WELCOMEPAGE_TEXT "The MySQL Test Install"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;!insertmacro MUI_UNPAGE_CONFIRM
;!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"



Section "install"
    File mysql.msi
    ExecWait 'msiexec /i "$INSTDIR\mysql.msi" /qn'
    SetOutPath "$PROGRAMFILES\MySQL\MySQL Server 5.7.15"

SectionEnd

As you can see all I do is ask the MSI to run silently and specify the install folder.

When I build the NSIS installer and run it the folder $PROGRAMFILES\MySQL\MySQL Server 5.7.15 appears but nothing is inside it.

I am sure there is something else I have to run but nothing I have tried results in an actual install.

Any pointers would be great?

Upvotes: 0

Views: 710

Answers (1)

Anders
Anders

Reputation: 101764

You need to use the SetOutPath instruction before File instructions because it sets the destination path for extracted files.

You normally do SetOutPath "$InstDir" before extracting files...

Upvotes: 1

Related Questions