Pre-General Availability Draft: 2018-02-21
MySQL Shell provides commands which enable you to modify the
execution environment of the code editor, for example to configure
the active programming language or a MySQL Server connection. The
following table lists the commands that are available regardless
of the currently selected language. As commands need to be
available independent of the execution mode,
they start with an escape sequence, the
Prints help about MySQL Shell commands.
Exit MySQL Shell.
In SQL mode, begin multiple-line mode. Code is cached and executed when an empty line is entered.
Show the current MySQL Shell status.
Switch execution mode to Python.
Switch execution mode to SQL.
Connect to a MySQL Server
Specify the schema to use.
Execute a script file using the active language.
Show any warnings generated by a statement.
Do not show any warnings generated by a statement.
View and edit command line history.
Manually update the autocomplete name cache
\help command can be used with or without
parameters. When used without parameters a general help is
printed including information about:
Available commands for the active mode.
When used with a parameter, the parameter must be a valid command. If that is the case, help for that specific command is printed including:
Supported aliases if any
Additional help if any
If the parameter is not a valid command, the general help is printed.
\connect command is used to connect to a
MySQL Server using an URI type string. See
Section 188.8.131.52, “Connecting using a URI String”.
If a password is required you are prompted for it.
option to create a session using the X Protocol to connect
to MySQL server instance. For example:
\connect --mysqlx root@localhost:33060
option to create a ClassicSession, enabling you to use the MySQL
protocol to issue SQL directly on a server. For example:
\connect --mysql root@localhost:3306
\status command displays information
about the current global connection. This includes information
about the server connected to, the character set in use, uptime,
and so on.
\source command is used to execute code
from a script at a given path. For example:
As the code is executed using the active language, executing a script in a different language than the currently selected execution mode language could lead to unexpected results.
\use command enables you to choose which
schema is active, for example:
\use command requires a global
development session to be active. The
command sets the current schema to the specified
schema_name and updates the
db variable to the object that represents the
\history command lists the commands you
have issued previously in MySQL Shell. Issuing
\history shows history entries in the order
that they were issued with their history entry number, which can
be used with the
\history command provides the following:
\history saveto save the history manually.
\history delete entrynumberto delete a history entry with the given number.
\history deleteto delete history entries within the range of the given entry numbers. If
lastnumberis ommitted, history entries are deleted from
firstnumberup to the last entry. If
lastnumbergoes past the last found history entry number, it deletes up to the last entry.
\history clearto delete the entire history.
For more information, see Section 19.2.4, “MySQL Shell Code History”.
When you have disabled the autocomplete name cache feature, use
\rehash command to manually update the
cache. For example, after you load a new schema by issuing the
\rehash to update the
autocomplete name cache. After this autocomplete is aware of the
names used in the database, and you can autocomplete text such
as table names and so on.