Pre-General Availability: 2024-01-25
To open the MySQL Shell Consoles tab:
DB Connectionsunder OPEN EDITORS to open or activate the MySQL Shell tab.
In the tab, navigate to the Open New Shell Console icon near the Editor list of the toolbar. For the icon's location, see the arrow in the following figure.
Click the icon, which opens a new shell session in the MySQL Shell Consoles tab.
Sessions are not persistent. When you close the MySQL Shell Consoles tab or exit the Visual Studio Code program, each GUI console associated with a session is also closed.
A new session is given a name automatically in the form of
Session , in
an incremental number starting with
1. If you
opened a session from a connection, the name includes the
connection's name (for example,
Basic). The number portion of a session name is not
recycled once it has been issued. For example, if you add a
Session 1) and then close it, the
next session you add (without restarting MySQL Shell) is given
Session 2. Renaming a session is not
By default, sessions added from the MySQL Shell Console browser are not yet connected. If you open a console session from a configured connection (see Connection actions), the established connection is passed to the new session.
The GUI Console toolbar shows the connection status of each session that is active in the editor. A breadcrumb-like indicator under the toolbar displays the following information interactively:
Before establishing a connection to the server, console session activity is limited.
After establishing a connection, the host name and port number used to create the session connection are visible (for example,
localhost:3306). If you specified a schema when you created the session connection, the name appears in the second of the breadcrumb unit. If not, you see
no schema selecteduntil you select one with the \use command.
The active language is shown as one of the following prompts in the editor:
You can use specific MySQL Shell commands, prefixed with \, which enable you to configure MySQL Shell regardless of the currently selected language. For more information, see MySQL Shell commands.
MySQL Shell provides an interactive code processing mode, where you type code at the MySQL Shell prompt and each entered statement is processed, with the result of the processing printed on screen.
It is possible to specify statements over multiple lines. When
automatically when a block of statements starts as in function
definitions, if-then statements, for loops, and so on. In SQL
mode, multiple-line mode requires that individual statements be
terminated with the semicolon character (
The subsequently entered statements are cached and shown as
separate tabs (named
Result #2, and so on) in the result area.
For more information, see Code Processing.