MySQL Shell API  8.0.26
Unified development interface for MySQL Products
MySQL Shell API Documentation

This document covers the JavaScript APIs available in the MySQL Shell:

  • X DevAPI - NoSQL Database API for MySQL and the MySQL Document Store.
  • ShellAPI - Shell API and backward compatibility API for MySQL Servers not supporting the X DevAPI.
  • AdminAPI - API for setting up and managing InnoDB clusters.

The functionality of the APIs is exposed through modules and global objects which are automatically available when the MySQL Shell starts.

  • The mysqlx module contains a complete development API to interact with MySQL Servers using a session through the X Protocol.
  • The mysql module contains a lightweight development API to interact with MySQL Servers using a classic session.
  • The dba global object enables you to administer InnoDB clusters using the AdminAPI.
  • The shell global object gives access to general purpose functions and properties.
  • The session1 global object is available when a global session is established.
  • The db global object is available when the global session is established through the X protocol using a default database.
  • The util global object that groups miscellaneous tools like upgrade checker and JSON import.
  • The os global object gives access to functions which allow to interact with the operating system.
  • The sys global object gives access to system specific parameters.

1 The session global object might be either a ClassicSession or a Session object depending on whether the global session was established using classic MySQL protocol or X protocol respectively. For additional details look at the connect function in the shell object.

For more information on the functionality these APIs provide see the following documentation:

  • The Using MySQL as a Document Store documentation explains how to use X DevAPI to achieve a NoSQL-like MySQL database.
  • The X DevAPI user guide provides details about and usage examples of the X DevAPI.
  • The InnoDB Cluster user guide explains how to use MySQL Shell and AdminAPI to set up and administer a highly available InnoDB cluster.
  • The Group Replication documentation provides detailed documentation on the replication group which InnoDB cluster utilizes.