Installing isolated instance of MySQL on Windows using silent install with .msi

Posted by Abram on Server Fault See other posts from Server Fault or by Abram
Published on 2011-02-09T19:59:48Z Indexed on 2012/10/16 23:03 UTC
Read the original article Hit count: 202

Filed under:

I'm trying to write an installer for an internal application we wrote. After it installs our application it then installs MySQL using the .msi installer in silent mode. I specify the install dir and data dir to that of a directory within my application's install directory, such as:

msiexec /i @@MYSQL_INSTALLER_FILE@@ /qn 
    INSTALLDIR="@@INSTALL_DIR@@\MySQL\" 
    DATADIR="@@INSTALL_DIR@@\MySQL\" 
    USERNAME="@@DB_USER@@" PASSWORD="@@DB_PASS@@"

(the @@variable@@'s are replace by my installer routine using InstallJammer)

Once installed, I use mysqld.exe to install a windows service with a custom service name and defaults file like so:

mysqld.exe --install CustomMySQL --defaults-file="@@INSTALL_DIR@@\MySQL\my.ini"

This works fine as long as there is not already another instance of MySQL installed. If there is it silently fails to install MySQL. Running the msi installer manually (double-click) shows an error that a previous version is already installed and just aborts.

Is there a way to automate installing MySQL as an isolated instance, regardless of whether another version/instance is already installed?

© Server Fault or respective owner

Related posts about mysql