Documentation Home
MySQL Shell 8.0
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
HTML Download (TGZ) - 126.1Kb
HTML Download (Zip) - 137.2Kb


MySQL Shell 8.0  /  Getting Started with MySQL Shell  /  MySQL Shell Global Objects

4.5 MySQL Shell Global Objects

MySQL Shell includes a number of built-in global objects that exist in both JavaScript and Python modes. The built-in MySQL Shell global objects are as follows:

  • session is available when a global session is established, and represents the global session.

  • dba provides access to InnoDB Cluster and InnoDB ReplicaSet administration functions using the AdminAPI. See Using MySQL AdminAPI.

  • cluster represents an InnoDB Cluster. Only populated if the --cluster option was provided when MySQL Shell was started.

  • rs represents an InnoDB ReplicaSet (added in version 8.0.20). Only populated if the --replicaset option was provided when MySQL Shell was started.

  • db is available when the global session was established using an X Protocol connection with a default database specified, and represents that schema.

  • shell provides access to various MySQL Shell functions, for example:

  • util provides various MySQL Shell tools, including the upgrade checker utility, the JSON import utility, and the parallel table import utility. See Chapter 7, MySQL Shell Utilities.

Important

The names of the MySQL Shell global objects are reserved as global variables and must not be used, for example, as names of variables. If you assign one of the global variables you override the above functionality, and to restore it you must restart MySQL Shell.

You can also create your own extension objects and register them as additional MySQL Shell global objects to make them available in a global context. For instructions to do this, see Section 6.2, “Adding Extension Objects to MySQL Shell”.