Documentation Home
MySQL 9.3 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 261.1Kb
Man Pages (Zip) - 368.3Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


22.3.1 MySQL Shell

This quick-start guide assumes a certain level of familiarity with MySQL Shell. The following section is a high level overview, see the MySQL Shell documentation for more information. MySQL Shell is a unified scripting interface to MySQL Server. It supports scripting in JavaScript and Python. SQL is the default processing mode.

Start MySQL Shell

After you have installed and started MySQL server, connect MySQL Shell to the server instance. You need to know the address of the MySQL server instance you plan to connect to. To be able to use the instance as a Document Store, the server instance must have X Plugin installed and you should connect to the server using X Protocol. For example to connect to the instanceds1.example.com on the default X Protocol port of 33060 use the network stringuser@ds1.example.com:33060.

Tip

If you connect to the instance using classic MySQL protocol, for example by using the defaultport of 3306 instead of themysqlx_port, youcannot use the Document Store functionality shown in this tutorial. For example thedb global object is not populated. To use the Document Store, always connect using X Protocol.

If MySQL Shell is not already running, open a terminal window and issue:

mysqlshuser@ds1.example.com:33060/world_x

Alternatively, if MySQL Shell is already running use the\connect command by issuing:

\connectuser@ds1.example.com:33060/world_x

You need to specify the address of the MySQL server instance which you want to connect MySQL Shell to. For example in the previous example:

  • user represents the user name of your MySQL account.

  • ds1.example.com is the hostname of the server instance running MySQL. Replace this with the hostname of the MySQL server instance you are using as a Document Store.

  • The default schema for this session isworld_x. For instructions on setting up theworld_x schema, seeSection 22.3.2, “Download and Import world_x Database”.

For more information, seeSection 6.2.5, “Connecting to the Server Using URI-Like Strings or Key-Value Pairs”.

Once MySQL Shell opens, themysql-js> prompt indicates that the active language for this session is SQL.

MYSQL SQL>

MySQL Shell supports input-line editing as follows:

  • left-arrow andright-arrow keys move horizontally within the current input line.

  • up-arrow anddown-arrow keys move up and down through the set of previously entered lines.

  • Backspace deletes the character before the cursor and typing new characters enters them at the cursor position.

  • Enter sends the current input line to the server.

Get Help for MySQL Shell

Typemysqlsh --help at the prompt of your command interpreter for a list of command-line options.

mysqlsh --help

Type\help at the MySQL Shell prompt for a list of available commands and their descriptions.

mysql-js> \help

Type\help followed by a command name for detailed help about an individual MySQL Shell command. For example, to view help on the\connect command, issue:

mysql-js> \help \connect

Quit MySQL Shell

To quit MySQL Shell, issue the following command:

mysql-js> \quit

Related Information