Managing Data

November 2, 2009

Silent Install Instructions

Filed under: Uncategorized — lstigile @ 10:50 pm
Tags: , ,

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.

Advertisement

11 Comments »

  1. Really useful – I await the next part with keen interest.

    Comment by David Goadby — November 12, 2009 @ 4:03 pm | Reply

  2. Thanks

    Comment by Anonymous — December 18, 2009 @ 4:57 pm | Reply

  3. Thanks Babu

    Comment by Raju — December 22, 2009 @ 4:56 pm | Reply

  4. Hi,

    How can I use character set with MySQLInstanceConfig.exe (paramaters)

    thanks

    Comment by agit — May 19, 2010 @ 7:57 am | Reply

  5. it helps a lot

    Comment by Anonymous — August 2, 2010 @ 1:47 am | Reply

  6. hi i am using mysql server 5.1.51. i followed your code to configure mysql server. but it is not configured. it shows error like below:

    could not open require default file: C:\Program Files\MySQL\MySQL Server 5.1\my.ini.
    fatal error in default handling. program aborted.

    i am using the code

    MySQLInstanceConfig.exe -i -q “-lC:\mysql_install_log.txt” “-nMySQL Server 5.1″ “-pC:\Program Files\MySQL\MySQL Server 5.1″ -v5.1.51 “-tC:\Program Files\MySQL\MySQL Server 5.1\my-template.ini” “-cC:\mytest.ini” ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=DSS Port=3306 ServiceName=MYSQL RootPassword=pass

    help me

    thanks in advance

    Comment by prabhu — October 5, 2010 @ 6:57 am | Reply

    • Did the my.ini file get created in c:\program files\mysql\mysql server 5.1\ ? Check that the file exists and verify that the permissions are read/write. Also, see if there are any errors logged in c:\mysql_install_log.txt

      Comment by Lee Stigile — October 5, 2010 @ 2:10 pm | Reply

  7. I didn’t get my.ini in c:\program files\mysql\mysql server 5.1\

    there is no error in log file and it contains the following

    —————————————-
    Welcome to the MySQL Server Instance Configuration Wizard 1.0.17.0
    Date: 2010-10-06 10:48:38

    Installing service …

    Product Name: MySQL Server 5.1
    Version: 5.1.51
    Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\

    Creating configuration file C:\Program Files\MySQL\MySQL Server 5.1\mytest.ini using template C:\Program Files\MySQL\MySQL Server 5.1\my-template.ini.
    Options:
    DEVELOPMENT
    MIXED
    DSS
    STRICTMODE

    Variables:
    port: 3306
    default-character-set: latin1
    basedir: “C:/Program Files/MySQL/MySQL Server 5.1/”
    datadir: “C:/Program Files/MySQL/MySQL Server 5.1/Data/”

    Creating Windows service entry.
    Service name: “MySQL”
    Parameters: “C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld” –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.1\mytest.ini” MySQL.
    Windows service MySQL installed.

    Comment by prabhu — October 6, 2010 @ 5:20 am | Reply

  8. I apologize for the delay. Please check the parameter: “-tC:\Program Files\MySQL\MySQL Server 5.1\my-template.ini”

    It sounds like the my.ini file is not getting created. The -t parameter takes a sample config file, which you have created; and uses that for the my.ini. Is there a my-template.ini in the directory specified? In my example, I use the my-small.ini, which is included with the install.

    Comment by Lee Stigile — October 7, 2010 @ 9:08 pm | Reply

  9. Hi ,

    when i gave command for MYSQLInstance config wizard with all the required parameters, it is getting stuck in between,not sure why this is happening,when i try to do it manually by running exe file of wizard it works fine,

    There are not errors in the log file too…

    Here is the command which i used…

    “C:\Program Files\MYSQL\MySQL Server 5.5\bin\MySQLInstanceConfig.exe” -i “-lC:\Program Files\MySQL\MySQL Server 5.5\mysql-instance-wizard-log.txt” “-nMySQL Server 5.5″ “-pC:\Program Files\MySQL\MySQL Server 5.5\” -v5.5.1 “tC:\Program Files\MySQL\MySQL Server 5.5\my-template.ini” “-cC:\Program Files\MySQL\MySQL Server 5.5\mynbm.ini” ServerType=DEVELOPMENT RootPassword=babu AddBinToPath=yes

    i tried giving (RootCurrentPassword=babu) along with this , to test whther this is causing the problem, but no clue..

    the log file shows the following

    Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
    Date: 2011-05-12 12:24:45

    Installing service …

    Product Name: MySQL Server 5.5
    Version: 5.5.1
    Installation Path: C:\Program Files\MySQL\MySQL Server 5.5\

    Creating configuration file C:\Program Files\MySQL\MySQL Server 5.5\mynbm.ini using template C:\Program Files\MySQL\MySQL Server 5.5\my-template.ini.
    Options:
    DEVELOPMENT
    MIXED
    DSS
    STRICTMODE

    Variables:
    port: 3306
    default-character-set: latin1
    basedir: “C:/Program Files/MySQL/MySQL Server 5.5/”
    datadir: “C:/Program Files/MySQL/MySQL Server 5.5/Data/”

    Creating Windows service entry.
    Service name: “MySQL”
    Parameters: “C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld” –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.5\mynbm.ini” MySQL.
    Windows service MySQL installed.

    Any help is appreciated….

    Thanks in Advance
    Suresh

    Comment by Suresh babu — May 12, 2011 @ 7:04 am | Reply

    • Unless something just changed in my XP environment, it seems as though the 5.5 installer doesn’t allow double-quotes. I removed quotes. I used a forward slash (/) to denote spaces. Here’s an example of a successful install.

      C:\installs\myapp\bin>MySQLInstanceConfig.exe -i -q -lC:\aa.txt -nMySQL/ Server/ 5/.1/.234 -pC:\installs\myapp -v5.1.
      -tc:\installs\myapp\my-small.ini -cC:\mytest.ini ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=DSS Port
      11 ServiceName=MySQLCust3 RootPassword=1234

      Comment by lstigile — May 13, 2011 @ 10:28 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.