The following features are available in MySQL Shell.
MySQL Shell provides an interactive code execution mode, where you type code at the MySQL Shell prompt and each entered statement is processed, with the result of the processing printed onscreen.
MySQL Shell processes code in the following languages:
of these languages, based on the language that is currently
active. There are also specific MySQL Shell commands, prefixed
\, which enable you to configure
MySQL Shell regardless of the currently selected language. For
more information see Section 18.4.1, “MySQL Shell Commands”.
In addition to the interactive execution of code, MySQL Shell can also take code from different sources and process it. This method of processing code in a non-interactive way is called Batch Execution.
As batch execution mode is intended for script processing of a
single language, it is limited to having minimal non-formatted
output and disabling the execution of commands. To avoid these
limitations, use the
command-line option, which tells MySQL Shell to execute the
input as if it were an interactive session. In this mode the input
is processed line by line just as if each
line were typed in an interactive session. For more information
see Section 18.3.5, “Batch Mode Made Interactive”.
MySQL Shell provides output in different formats depending on how it is used: Tabbed, Table and JSON. For more information see Section 18.3.3, “Output Formats”.
Multiple-line code can be written using a command, enabling MySQL Shell to cache multiple lines and then execute them as a single statement. For more information see Section 126.96.36.199, “Multiple-line Support”.
MySQL Shell can be configured to log information about the execution process. For more information see Section 18.5, “MySQL Shell Application Log”.
The X DevAPI enables you to work with both relational and document data when MySQL Shell is connected to a MySQL server using the X Protocol. For more information, see Chapter 19, Using MySQL as a Document Store. For documentation on the concepts and usage of X DevAPI, see X DevAPI User Guide.
The AdminAPI enables you to work with InnoDB cluster, which provides an integrated solution for high availability and scalability using InnoDB based MySQL databases, without requiring advanced MySQL expertise. See Chapter 20, InnoDB Cluster.
MySQL Shell is designed to provide an integrated command-line client for all MySQL products which support X Protocol. The development features of MySQL Shell are designed for sessions using the X Protocol. MySQL Shell can also connect to MySQL Servers that do not support the X Protocol using the legacy MySQL Protocol. A minimal set of features from the X DevAPI are available for sessions created using the legacy MySQL protocol.
Interaction with a MySQL Server is done through a Session object.
getNodeSession functions of the mysqlx module.
if the session is created in Python mode. None of these sessions
can be used in SQL mode.
For SQL Mode, the concept of Global Session is supported by the
MySQL Shell. A Global Session is created when the connection
information is passed to MySQL Shell using command-line options,
or by using the
The Global Session is used to execute statements in SQL mode and
When a Global Session is created, a variable called
session is set in the scripting languages, so
you can execute code in the different languages by switching the
For more information, see Section 18.2.2, “MySQL Shell Sessions”.