Getting Help in MySQL Shell

The MySQL Shell has a collection of commands and APIs that allow performing a variety of tasks on MySQL instances  interactively or through scripts.

Although there’s documentation for the JavaScript and Python APIs as well as the User Guide, it comes handy being able to get help about how to use specific elements of the application while working with it, this is what the centralized help system does.

The \help command (or \?) is the access point to get help for the different topics, help is organized in categories including:

  • Shell Commands
  • AdminAPI:
  • X DevAPI
  • Shell API
  • SQL Syntax

To start getting familiar with the help system execute \? or \? contents  in the MySQL Shell prompt.

Help on Shell Commands

The Shell Commands category encloses all the help available for the Shell Commands, giving the category name to the \help command will make it display the list of available shell commands and a short description of what they do:

As described in the example at the bottom of the image, passing a command name to the \help command will display further details specific to that command.

Help on Available APIs

The starting point to get help on the different APIs available is by searching help on the associated category:

The functionality on each API is provided in modules which contain classes, global objects and functions.

Getting help for an API category will list the modules, classes, functions and objects available in it.

To get more detailed help for a specific element in an API issue: \? <name> where name is the name of the module, class, object or function for which help is being queried.

In the case of modules, classes and objects it will list objects and functions that belong to them.

In case of functions it will display details about what it does as well as the parameters and returned values if applicable.

Full Topic Names

Each topic registered in the help system contains a unique identifier. In the case of the API elements, it is the fully qualified name in the format of:

[[<module_name>.]<class_name>.]<member_name>

When using just the member name to search for help, it is common that multiple topics are found with the same name, this is specially common when looking for help on an API function.

On these cases,  a list organized by category will be displayed, listing the fully qualified id of the found topics. Giving the fully qualified if to the \? command will display the information specific for the selected topic.

Help on SQL Syntax (Server Side Help)

The SQL Syntax category can be used to display information from the MySQL Reference Manual. There are two conditions that must be met to make this available:

  • A global session must be established on the Shell.
  • The mysql system database must have the help tables properly setup.

When these conditions are met, getting help for the SQL Syntax is enabled.

The information in the MySQL Reference Manual is also organized in categories and topics, getting help for the SQL Syntax category lists the main categories of the MySQL Reference Manual.

The different SQL statements are topics in the MySQL Reference Manual and the \help command also allows displaying help for them.

Help Search Patterns

It is possible that the specific topic name for which help is required is unknown, making it difficult to find help about it. For this reason the help system supports using wildcard characters on the topic being searched as follows:

  • ? matches a single character
  • *matches multiple characters

This way it is possible to first list the items with just part of the name, once the list if items is available, it is possible to lookup for the fully qualified name of the specific item for which help is required.

About Rene Ramirez

Juan Rene Ramirez Monarrez (a.k.a. rennox) is a Software Engineer with a master degree in Computer Science residing in Mexico. He started his career at IBM almost 20 years ago in application development, had a pass on Automation at Freescale Semiconductor (now MXP) and landed at the MySQL world 8 years ago. At MySQL he started working at the Workbench team and now is leading the efforts to make the MySQL Shell the client by excellence for different MySQL products.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter * Time limit is exhausted. Please reload CAPTCHA.