2

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?

1 Answer 1

3

Oh yes there is.

For one thing, I am not a big fan of using .msi for MySQL.

I like doing the following to create a full Windows service without using .msi

01) Download the no-install zip of MySQL to your desktop.

02) Open the Zip File in Window1. You should see the data folder, bin folder, several my.ini files and other files.

03) Create a Server Folder and a Data Folder in a Desired Location. For this example, in a DOS Window, do the following :

md C:\MySQLServer
md C:\MySQLData

04) Open C:\MySQLServer in Window Explorer (Window2)

05) Copy and Paste the Zip Contents (Window1) into the C:\MySQLServer (Window2)

06) Open C:\MySQLServer\data in Windows Explorer (Window3)

07) Open C:\MySQLData in Window Explorer (Window4)

08) Copy and Paste the Contents of C:\MySQLServer\data (Window3) into C:\MySQLData (Window4)

09) Close Window3 and Window4

10) Open a DOS Window and run the following DOS commands

cd C:\MySQLServer
copy my-medium.ini my.ini
notepad my.ini
define datadir="C:\\MySQLData"
cd C:\MySQLServer\bin
mysqld --install MySQLNew
net start MySQLNew

11) Close all Windows

You should be done !!!

Let us know how it turned out !!!

BTW The service name turns out as MySQLNew

5
  • This doesn't exactly solve installing using the msi, but at least it works. Any idea where the noinstall package for 5.5 is? I could only find 5.1.
    – Abram
    Feb 15, 2011 at 16:47
  • 1. Goto mysql.com/downloads/mysql 2. You will see 2 MSI Installers and 3 ZIP Archives. Choose any of the three ZIP files (2 are 32-bit,last on is 64-bit) Feb 15, 2011 at 17:05
  • Thanks. Previous versions had used 'noinstall' in the name and would have another zip file without noinstall so I wasn't sure if these were the correct ones or not.
    – Abram
    Feb 15, 2011 at 18:18
  • Thanks for the instructions. This is far more easy and intuitive than running the installer, and with the added benefit that it actually doesn't throw an error 1067. Sometimes I think installers have started to create more work then they solve and actually make fairly smart people ignorant.
    – user80031
    May 1, 2011 at 6:37
  • Rolando, Your solution is quite smart. I mucked around with the MSIs and got so frustrated. Although, in Windows 7, I had to turn off User Account Control [UAC] in Control Panel in order to get your solution to work. You are brilliant. Cheers.
    – user87205
    Jul 10, 2011 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .