Documentation Home
MySQL Shell for VS Code


MySQL Shell for VS Code  /  MySQL Shell Consoles  /  Process Commands in GUI Console

Pre-General Availability: 2024-10-04

5.5 Process Commands in GUI Console

To process MySQL Shell commands:

  1. Select the active language by entering:

    • \js to make JavaScript the active language.

    • \py to make Python the active language.

    • \sql to make SQL the active language.

  2. Enter the command at the command prompt. There is autocomplete functionality for recognized JavaScript and Python methods.

  3. Use Ctrl+Enter to issue the command. Any output is displayed below the command. Any errors are also displayed below the command. The errors are dependent on the active language. For example, syntax errors in JavaScript commands display AttributeErrors differently to AttributeErrors in Python.

Note

Not all commands show an output.

MySQL Shell provides commands which enable you to modify the execution environment.

The following table lists the commands that are available regardless of the currently selected language. As commands need to be available independent of the processing mode, they start with an escape sequence, the \ character.

Command Alias/Shortcut Description
\help \h or \? Print help about MySQL Shell, or search the online help.
\quit \q or \exit Exit MySQL Shell.
\ In SQL mode, begin multiple-line mode. Code is cached and executed when an empty line is entered.
\status \s Show the current MySQL Shell status.
\js Switch mode to JavaScript.
\py Switch mode to Python.
\sql Switch mode to SQL.
\connect \c Connect to a MySQL instance.
\reconnect Reconnect to the same MySQL instance.
\disconnect Disconnect the global session.
\use \u Specify the schema to use.
\source \. or source (no backslash) Process a script file using the active language.
\warnings \W Show any warnings generated by a statement.
\nowarnings \w Do not show any warnings generated by a statement.
\history View and edit command history.
\rehash

Manually update the autocomplete name cache.

\option Query and change MySQL Shell configuration options.
\show Run the specified report using the provided options and arguments.
\watch Run the specified report using the provided options and arguments, and refresh the results at regular intervals.
\edit \e Open a command in the default system editor then present it in MySQL Shell.
\pager \P Configure the pager which MySQL Shell uses to display text.
\nopager

Disable any pager which MySQL Shell was configured to use.

\system

\!

Run the specified operating system command and display the results in MySQL Shell.

Warning

The \source command does not function as expected.

When attempting to use the \source command, you must note that Visual Studio Code is a web environment that does not permit direct disk access. Therefore, although listed in the help options, it is difficult to process a script using the \source command.