MySQL Shell commands
MySQL Shell commands
In this tutorial, we will learn about MySQL Shell commands. MySQL Shell includes APIs implemented in JavaScript and Python which can be used to develop application that interacts with the MySQL database. MySQL Shell is cross-platform and is available on Windows, Linux, and Mac OS for 64-bit platforms.
Shell Help
The Shell Help is organized in categories and topics. To get help for a
specific category or topic use:
\? <pattern>
The <pattern> argument should be the name of a category or a topic.
The pattern is a filter to identify topics for which help is required, it can
use the following wildcards:
– ? matches any single character.
– * matches any character sequence.
Help Categories
The following are the main help categories:
– AdminAPI The AdminAPI is an API that enables configuring and managing
InnoDB clusters and replicasets, among other things.
– Shell Commands Provides details about the available built-in shell commands.
– ShellAPI Contains information about the shell and util global objects
as well as the mysql module that enables executing SQL on
MySQL Servers.
– SQL Syntax Entry point to retrieve syntax help on SQL statements.
– X DevAPI Details the mysqlx module as well as the capabilities of the
X DevAPI which enable working with MySQL as a Document Store
The available topics include:
– The dba global object and the classes available at the AdminAPI.
– The mysqlx module and the classes available at the X DevAPI.
– The mysql module and the global objects and classes available at the
ShellAPI.
– The functions and properties of the classes exposed by the APIs.
– The available shell commands.
– Any word that is part of an SQL statement.
– Command Line – invoking built-in shell functions without entering interactive
mode.
MySQL Shell Commands
The shell commands allow executing specific operations including updating the
shell configuration.
The following shell commands are available:
– \ Start multi-line input when in SQL mode.
– \connect (\c) Connects the shell to a MySQL server and assigns the
global session.
– \disconnect Disconnects the global session.
– \edit (\e) Launch a system editor to edit a command to be executed.
– \exit Exits the MySQL Shell, same as \quit.
– \help (\?,\h) Prints help information about a specific topic.
– \history View and edit command line history.
– \js Switches to JavaScript processing mode.
– \nopager Disables the current pager.
– \nowarnings (\w) Don’t show warnings after every statement.
– \option Allows working with the available shell options.
– \pager (\P) Sets the current pager.
– \py Switches to Python processing mode.
– \quit (\q) Exits the MySQL Shell.
– \reconnect Reconnects the global session.
– \rehash Refresh the autocompletion cache.
– \show Executes the given report with provided options and
arguments.
– \source (\.) Loads and executes a script from a file.
– \sql Executes SQL statement or switches to SQL processing
mode when no statement is given.
– \status (\s) Print information about the current global session.
– \system (\!) Execute a system shell command.
– \use (\u) Sets the active schema.
– \warnings (\W) Show warnings after every statement.
– \watch Executes the given report with provided options and
arguments in a loop.
Examples
\? AdminAPI
Displays information about the AdminAPI.
\? \connect
Displays usage details for the \connect command.
—
MySQL Tutorials
MySQL Tutorials on this website:
https://www.testingdocs.com/mysql-tutorials-for-beginners/
For more information on MySQL Database: