3.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 1.3.2 includes a command-line client mcm, located in the installation bin directory. mcm can be invoked with any one of the options shown in the following table:

Long formShort formDescription
--help-?Display mcm client options
--version-VShows MySQL Cluster Manager agent/client version.
-WShows MySQL Cluster Manager agent/client version, with version of mysql used by mcm.
--address-aHost and optional port to use when connecting to mcmd, in host[:port] format; default is 127.0.0.1:1862.
--mysql-help-IShow help for mysql client (see following).

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

mcm actually acts as a wrapper for the mysql client that is included with the bundled MySQL Cluster distribution. Invoking mcm with no options specified is equivalent to the following:

shell> mysql -umcmd -psuper -h 127.0.0.1 -P 1862 --prompt="mcm>"

(These -u and -p options and values are hard-coded and cannot be changed.) This means that you can use the mysql client to run MySQL Cluster Manager client sessions on platforms where mcm itself (or even mcmd) is not available. For more information, see Connecting to the agent using the mysql client.

If you experience problems starting an MySQL Cluster Manager client session because the client fails to connect, see Can'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 the exit or quit command (short form: \q). Neither of these commands requires a separator or terminator character.

For more information, see Chapter 4, MySQL Cluster Manager Client Commands.

Connecting to the agent with the mcm client.  You can connect to the MySQL Cluster Manager agent by invoking mcm (or, on Windows, mcm.exe). You may also need to specify a hostname, port number, or both, using the following command-line options:

mcm accepts additional mysql 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 of get 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 with mcm and so cannot be guaranteed to work correctly (or even at all). See mysql Options, for a complete listing and descriptions of all mysql client options.

Note

Like the mysql 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. See Chapter 4, MySQL Cluster Manager Client Commands, for examples.

Connecting to the agent using the mysql client.  As mentioned previously, mcm actually serves as a wrapper for the mysql client. In fact, a mysql client from any recent MySQL distribution (MySQL 5.1 or later) should work without any issues for connecting to mcmd. In addition, since the client-server protocol used by MySQL Cluster Manager is platform-independent, you can use a mysql client on any platform supported by MySQL. (This means, for example, that you can use a mysql 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 the mysql client is accomplished by invoking mysql and specifying a hostname, port number, username and password, using the following command-line options:

In addition, you can use the --prompt option to set the mysql 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 the mysql client on the same machine from the system shell in a manner similar to what is shown here.

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

For convenience, on systems where mcm 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 named mcm-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:

shell> ./mcm-client

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

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

(Adjust the path to the mysql.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 new cmd.exe (DOS) window.