Developers, Developers, Developers! Maksim Sorokin IT Blog

21Apr/101

MySQL Silent Installation

Here is a bat file example:

echo off
cls

echo Starting MySQL mysql-essential-5.0.88-win32 install
msiexec /i "mysql-essential-5.0.88-win32" /qn INSTALLDIR="C:\Program Files\MySQL" /L* "C:\Program Files\MySQL\mysql-log.txt"
echo MySQL mysql-essential-5.0.88-win32 installed successfully

echo Creating MySQL Windows service
"C:\Program Files\MySQL\bin\mysqlinstanceconfig.exe" -i -q ServiceName="MySQL service" RootPassword="newRootPassword" ServerType=SERVER DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql
echo MySQL Instance Configured. Service started.

Which can be conveniently parametrized with your installation packager, for example:

echo off
cls

echo Starting MySQL ${mysql-msi} install
msiexec /i "${mysql-msi}" /qn INSTALLDIR="${INSTALL_PATH}\${mysql-dir}" /L* "${INSTALL_PATH}\mysql-log.txt"
echo MySQL ${mysql-msi} installed successfully

echo Creating MySQL Windows service
"${INSTALL_PATH}\${mysql-dir}\bin\mysqlinstanceconfig.exe" -i -q ServiceName="${mysql-service-name}" RootPassword="${mysql-password}" ServerType=SERVER DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql
echo MySQL Instance Configured. Service started.

But do not forget that if you want to ship MySQL with your product, you have to have an official permission from MySQL. Another option would be to ask user to download executable and provide a location to it int your installer.

Tagged as: Leave a comment
Comments (1) Trackbacks (3)
  1. Thanx! it works, but after doing some changes.we have to add .msi extension for the
    “mysql-essential-5.0.88-win32″ as “mysql-essential-5.0.88-win32.msi”
    thanks again…….


Leave a comment