Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 

(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?

share|improve this question
up vote 3 down vote accepted

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

share|improve this answer
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 '11 at 16:47
1. Goto 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) – RolandoMySQLDBA Feb 15 '11 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 '11 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 '11 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 '11 at 23:54

protected by splattne Jul 11 '11 at 13:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.