Documentation Home
MySQL Cluster Manager 9.3 User Manual
Related Documentation Download this Manual
PDF (US Ltr) - 1.3Mb
PDF (A4) - 1.3Mb


MySQL Cluster Manager 9.3 User Manual  / Using MySQL Cluster Manager  /  Starting the MySQL Cluster Manager Client

4.3 Starting the MySQL Cluster Manager Client

This section covers starting the MySQL Cluster Manager client and connecting to the MySQL Cluster Manager agent.

MySQL Cluster Manager 9.3.0 includes a command-line clientmcm, located in the installationbin directory.mcm can be invoked with any one of the options shown in the following table (seeConnecting to the agent with themcm client for detailed descriptions of some of the options):

Table 4.3 mcm options

Long formShort formDescription
--help-?Displaymcm client options
--host=<hostname>-h<hostname>Host to use when connecting tomcmd
--user=<username>-u<username>The user name for connecting to the agent
--password[=<password>]-p[<password>]The password for connecting to the agent
--port=<portnum>-P<portnum>Optional port to use when connecting tomcmd
--version-VShows MySQL Cluster Manager agent/client version

The client/server protocol used by MySQL Cluster Manager is platform-independent. You can connect to any MySQL Cluster Manager agent with anmcm client on any platform where it is available. This means, for example, that you can use anmcm client on Microsoft Windows to connect to a MySQL Cluster Manager agent that is running on a Linux host.

You can also use themysql client to run MySQL Cluster Manager client sessions on platforms wheremcm itself (or evenmcmd) is not available. For more information, seeConnecting to the agent using themysql client.

If you experience problems starting an MySQL Cluster Manager client session because the client fails to connect, seeCan't connect to [local] MySQL server, for some reasons why this might occur, as well as suggestions for some possible solutions.

To end a client session, use theexit orquit command (short form:\q). Neither of these commands requires a separator or terminator character.

For more information, seeChapter 5,MySQL Cluster Manager Client Commands.

Connecting to the agent with themcm client.  You can connect to the MySQL Cluster Manager agent by invokingmcm (or, on Windows,mcm.exe). You may also need to specify one or more of the following command-line options:

  • --host=hostname or-h[ ]hostname

    This option takes the name or IP address of the host to connect to. The default islocalhost (which may not be recognized on all platforms when starting amcm client session even if it works for startingmysql client sessions).

    You should keep in mind that themcm client does not perform host name resolution; any name resolution information comes from the operating system on the host where the client is run. For this reason, it is usually best to use a numeric IP address rather than a hostname for this option.

  • --port=portnumber or-P[ ]portnumber

    This option specifies the TCP/IP port for the client to use. This must be the same port that is used by the MySQL Cluster Manager agent. As mentioned elsewhere, if no agent port is specified in the MySQL Cluster Manager agent configuration file (mcmd.ini), the default number of the port used by the MySQL Cluster Manager agent is 1862, which is also used by default bymcm.

  • --user=username or-u[ ]username

    The option specifies the user name for connecting to the agent. The default value ofmcmd is used if the option is not specified. To connect successfully, the value of the option must match that specified by themcmd configuration optionmcmd-user of the agent you are connecting to, which is alsomcmd by default.

  • --password[=password] or-p[password]

    The option specifies the password for connecting to the agent. To connect successfully, the value of the option must match that specified by themcmd configuration optionmcmd_password of the agent you are connecting to.

    If you use the short option form (-p), youmust not leave a space between this option and the password. If you omit thepassword value following the--password or-p option on the command line, themcm client prompts you for one.

    Specifying a password on the command line should be considered insecure. It is preferable that you either omit the password when invoking the client and then supply it when prompted, or put the password in a startup script or configuration file.

    This option must be specified for the client to connect to the agent.

mcm accepts additionalmysql client options, some of which may possibly be of use for MySQL Cluster Manager client sessions. For example, the--pager option might prove helpful when the output ofget contains too many rows to fit in a single screen. The--prompt option can be used to provide a distinctive prompt to help avoid confusion between multiple client sessions. However, options not shown in the current manual have not been extensively tested withmcm and so cannot be guaranteed to work correctly (or even at all). Seemysql Client Options, for a complete listing and descriptions of allmysql client options.

Note

Like themysql client,mcm also supports\G as a statement terminator, which causes the output to be formatted vertically. This can be helpful when using a terminal whose width is restricted to some number of (typically 80) characters. SeeChapter 5,MySQL Cluster Manager Client Commands, for examples.

Connecting to the agent using themysql client.  Amysql client from any MySQL distribution should work without any issues for connecting tomcmd. In addition, since the client/server protocol used by MySQL Cluster Manager is platform-independent, you can use amysql client on any platform supported by MySQL. (This means, for example, that you can use amysql client on Microsoft Windows to connect to a MySQL Cluster Manager agent that is running on a Linux host.) Connecting to the MySQL Cluster Manager agent using themysql client is accomplished by invokingmysql and specifying a hostname, port number, username and password using the following command-line options:

  • --host=hostname or-hhostname

    This option takes the name or IP address of the host to connect to. The default islocalhost. Like themcm client, themysql client does not perform host name resolution, and relies on the host operating system for this task. For this reason, it is usually best to use a numeric IP address rather than a hostname for this option.

  • --port=portnumber or-Pportnumber

    This option specifies the TCP/IP port for the client to use. This must be the same port that is used by the MySQL Cluster Manager agent. Although the default number of the port used by the MySQL Cluster Manager agent is 1862 (which is also used by default bymcm),this default value is not known to themysql client, which uses port 3306 (the default port for the MySQL server) if this option is not specified whenmysql is invoked.

    Thus, youmust use the--port or-P option to connect to the MySQL Cluster Manager agent using themysql client,even if the agent process is using the MySQL Cluster Manager default port, and even if the agent process is running on the same host as themysql client. Unless the correct agent port number is supplied to it on startup,mysql is unable to connect to the agent.

  • --user=username or-uusername

    The option specifies the user name for connecting to the agent. By default, themysql client tries to use the name of the current system user on Unix systems andODBC on Windows, so youmust supply this option and the username when trying to access the MySQL Cluster Manager agent with themysql client; otherwise,mysql cannot connect to the agent.

    To connect successfully, the value of the option must match that specified by themcmd configuration option--mcmd-user of the agent you are connecting to, which ismcmd by default.

  • --password[=password] or-p[password]

    The option specifies the password for connecting to the agent. If you do not include the--password or-p option when invokingmysql, it cannot connect to the agent. To connect successfully, the value of the option must match that specified by themcmd configuration optionmcmd_password of the agent you are connecting to, which issuper by default.

    If you use the short option form (-p), youmust not leave a space between this option and the password. If you omit thepassword value following the--password or-p option on the command line, themysql client prompts you for one.

    Specifying a password on the command line should be considered insecure. It is preferable that you either omit the password when invoking the client and then supply it when prompted, or put the password in a startup script or configuration file.

In addition, you can use the--prompt option to set themysql client's prompt. This is recommended, since allowing the default prompt (mysql>) to be used could lead to confusion between a MySQL Cluster Manager client session and a MySQL client session.

Thus, you can connect to a MySQL Cluster Manager agent by invoking themysql client on the same machine from the system shell in a manner similar to what is shown here.

$> mysql -h127.0.0.1 -P1862 -umcmd -p --prompt='mcm> '

For convenience, on systems wheremcm itself is not available, you might even want to put this invocation in a startup script. On a Linux or similar system, this script might be namedmcm-client.sh, with contents similar to what is shown here:

#!/bin/sh/usr/local/mysql/bin/mysql -h127.0.0.1 -P1862 -umcmd -p --prompt='mcm> '

In this case, you could then start up a MySQL Cluster Manager client session using something like this in the system shell:

$> ./mcm-client

On Windows, you can create a batch file with a name such asmcm-client.bat containing something like this:

C:\mysql\bin\mysql.exe -umcmd -psuper -h localhost -P 1862 --prompt="mcm> "

(Adjust the path to themysql.exe client executable as necessary to match its location on your system.)

If you save this file to a convenient location such as the Windows desktop, you can start a MySQL Cluster Manager client session merely by double-clicking the corresponding file icon on the desktop (or in Windows Explorer); the client session opens in a newcmd.exe (DOS) window.