2.3.4.13. MySQL Server Instance Config Wizard: Creating an Instance from the Command Line

In addition to using the GUI interface to the MySQL Server Instance Config Wizard, you can also create instances automatically from the command line.

To use the MySQL Server Instance Config Wizard on the command line, you need to use the MySQLInstanceConfig.exe command that is installed with MySQL in the bin directory within the installation directory. MySQLInstanceConfig.exe takes a number of command-line arguments the set the properties that would normally be selected through the GUI interface, and then creates a new configuration file (my.ini) by combining these selections with a template configuration file to produce the working configuration file.

The main command line options are provided in the table below. Some of the options are required, while some options are optional.

Table 2.4. MySQL Server Instance Config Wizard Command Line Options

OptionDescription
Required Parameters
-nPRODUCTNAMEThe name of the instance when installed
-pPATHPath of the base directory for installation. This is equivalent to the directory when using the basedir configuration parameter
-vVERSIONThe version tag to use for this installation
Action to Perform
-iInstall an instance
-rRemove an instance
-sStop an existing instance
-qPerform the operation quietly
-lFILENAMESae the installation progress in a logfile
Config File to Use
-tFILENAMEPath to the template config file that will be used to generate the installed configuration file
-cFILENAMEPath to a config file to be generated

The -t and -c options work together to set the configuration parameters for a new instance. The -t option specifies the template configuration file to use as the basic configuration, which are then merged with the configuration parameters generated by the MySQL Server Instance Config Wizard into the configuration file specified by the -c option.

A sample template file, my-template.ini is provided in the toplevel MySQL installation directory. The file contains elements are replaced automatically by the MySQL Server Instance Config Wizard during configuration.

If you specify a configuration file that already exists, the existing configuration file will be saved in the file with the original, with the date and time added. For example, the mysql.ini will be copied to mysql 2009-10-27 1646.ini.bak.

The parameters that you can specify on the command line are listed in the table below.

Table 2.5. MySQL Server Instance Config Wizard Parameters

ParameterDescription
ServiceName=$Specify the name of the service to be created
AddBinToPath={yes | no}Specifies whether to add the binary directory of MySQL to the standard PATH environment variable
ServerType={DEVELOPMENT | SERVER | DEDICATED}Specify the server type. For more information, see Section 2.3.4.4, “The Server Type Dialog”
DatabaseType={MIXED | INNODB | MYISAM}Specify the default database type. For more information, see Section 2.3.4.5, “The Database Usage Dialog”
ConnectionUsage={DSS | OLTP}Specify the type of connection support, this automates the setting for the number of concurrent connections (see the ConnectionCount parameter). For more information, see Section 2.3.4.7, “The Concurrent Connections Dialog”
ConnectionCount=#Specify the number of concurrent connections to support. For more information, see Section 2.3.4.4, “The Server Type Dialog”
SkipNetworking={yes | no}Specify whether network support should be supported. Specifying yes disables network access altogether
Port=#Specify the network port number to use for network connections. For more information, see Section 2.3.4.8, “The Networking and Strict Mode Options Dialog”
StrictMode={yes | no}Specify whether to use the strict SQL mode. For more information, see Section 2.3.4.8, “The Networking and Strict Mode Options Dialog”
Charset=$Specify the default character set. For more information, see Section 2.3.4.9, “The Character Set Dialog”
RootPassword=$Specify the root password
RootCurrentPassword=$Specify the current root password then stopping or reconfiguring an existing service
Note

When specifying options on the command line, you can enclose the entire command-line option and the value you are specifying using double quotation marks. This enables you to use spaces in the options. For example, "-cC:\mysql.ini".

The following command installs a MySQL Server 5.5 instance from the directory C:\Program Files\MySQL\MySQL Server 5.5 using the service name MySQL55 and setting the root password to 1234.

shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
   "-nMySQL Server 5.5" "-pC:\Program Files\MySQL\MySQL Server 5.5" -v5.5.9 »
   "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT DatabaseType=MIXED »
   ConnectionUsage=DSS Port=3311 ServiceName=MySQL55 RootPassword=1234

In the above example, a log file will be generated in mysql_install_log.txt containing the information about the instance creation process. The log file generated by the above example is shown below:

Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
Date: 2009-10-27 17:07:21

Installing service ...

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

Creating configuration file C:\mytest.ini using template my-template.ini.
Options:
DEVELOPMENT
MIXED
DSS
STRICTMODE

Variables:
port: 3311
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: "MySQL55"
Parameters:   "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\mytest.ini" MySQL55.
Windows service MySQL55 installed.

When using the command-line, the return values in the following table indicate an error performing the specified option.

Table 2.6. Return Value from MySQL Server Instance Config Wizard

ValueDescription
2Configuration template file cannot be found
3The Windows service entry cannot be created
4Could not connect to the Service Control Manager
5The MySQL service cannot be started
6The MySQL service cannot be stopped
7The security settings cannot be applied
8The configuration file cannot be written
9The Windows service entry cannot be removed

You can perform an installation of MySQL automatically using the MSI packe. For more information, see Section 2.3.3.2, “Automating MySQL Installation on Microsoft Windows using the MSI Package”.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout