This entry provides instructions for “silently” installing MySQL on a Microsoft Windows server. I use the term “silent install” to describe the method of passing parameters to the Microsoft Installation Package (MSI) to bypass installation screens. This allows you to deploy MySQL with your application and to install MySQL without end-user intervention. The developer can define the install location, the appropriate storage engines, the root password and the server configuration.
Most application developers use some sort of software for creating an application installer. Common tools include Install Shield, Wise Installation, InstallBuilder and Windows Installer. These installation software tools can also be used to install MySQL by launching the MySQL MSI and the MySQL Instance configuration utility ( MySQLInstanceConfig.exe ) from the command-line.
To get started, download the Windows Essentials from http://dev.mysql.com/downloads.
Then, look for an option in your installation tool to execute the following:
C:\>msiexec /q /log install.txt /i mysql-advanced-5.1.32-win32.msi datadir=”c:\installs\myapp” installdir=”c:\installs\myapp”
The MSI installer will add MySQL to the start menu, add registry values and add MySQL to the add/remove programs option from the control panel.
To configure the server, prepare the my.ini, set the root password and start the service, you’ll need to execute the following:
C:\>MySQLInstanceConfig.exe -i -q “-lC:\mysql_install_log.txt” “-nMySQL Server 5.1.234” -pC:\installs\myapp” -v5.1.234 “tc:\installs\myapp\my-small.ini” “-cC:\mytest.ini ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=DSS Port=3311 ServiceName=MySQLCust RootPassword=1234
This installation method has the benefit of adding MySQL to the control panel and the startup menus. It also installs the default mysql tables. The only remaining task is to import your application tables into MySQL by running mysqldump ( http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html ) on your development server and then loading the dump files into the target server.
In a future blog entry, I’ll discuss launching the mysqld.exe directly without actually installing MySQL.