Dan
Dan

Reputation: 2344

Installing a full MySQL install silently using NSIS

I have a basic NSIS script setup like so:

!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"
    
    SetOutPath $INSTDIR
    File /r "V:\Installers\MySQL\Release\*.*"
    ExecWait '"$SYSDIR\msiExec" /i "$INSTDIR\mysql.msi" /passive'
    
    
SectionEnd

However, this only seems to install another installer:

mysql install folder

If I run the .msi file manually I get to choose "full" and the process actually installs MySQL in full, with the service running etc.

How can I achieve this kind of install, silently, using NSIS?

Update:

I tried a lot of various commands and found that nothing I did installed the full MySQL with arguments. I managed to install MySQL full, but this didn't install the service and other key features (top part of http://dev.mysql.com/doc/relnotes/mysql-installer/en/mysql-installer-news-1-4-12.html)

I tried the second section of the above link, with no luck. All it did was install a folder with the options shown in the image above.

I tried using the command installer, as the poster below alluded to. However, this gave me an Oracle login prompt! I need to install and this this up without user interaction.

enter image description here

Any ideas?

Upvotes: 1

Views: 4302

Answers (2)

Andres Mauricio
Andres Mauricio

Reputation: 11

In the installer script will copy the file "mysql.msi" to the installation directory. First, create the mysql.msi file in the same directory as the installer script below then compile the installer script. If the installer script is on the Desktop, delete the mysql.msi file before running the compiled installer. Running the simple installer installs the mysql.msi file to the Desktop.

You will have to modify the script as follows:

ExecWait '"$SYSDIR\msiExec" /i "$INSTDIR\mysql.msi" /qn'

Upvotes: 0

Anders
Anders

Reputation: 101606

It would probably be possible to continue the installation by executing MySQLInstallerConsole as documented here but it is of course much better to get the .msi to perform the installation and to do that you need to figure out the right parameters to pass to msiexec.

These parameters are only known to the authors of the .msi and I had a really hard time finding documentation for it on the MySQL website. The only place I found any useful information was in the installer release notes!

I found some references to installdir and datadir parameters here. I'm not sure if these are MSI parameters or if they go in the CONSOLEARGS string.

When using the /passive switch it seems you are able to pass a string parameter called CONSOLEARGS and it supports a lot of options as documented here:

msiexec /i mysql-installer-community-5.6.27.1.msi /passive CONSOLEARGS="install -type=Full -silent"

or

msiexec /i mysql-installer-community-5.6.27.1.msi /passive CONSOLEARGS="install server;5.6.27;x64:*:type=config;openfirewall=true;generallog=true;binlog=true;serverid=1;enable_tcpip=true;port=3306;rootpasswd=secret:type=user;username=root;password=secret;role=DBManager -silent"

Upvotes: 1

Related Questions