MySQL Shell 8.0


MySQL Shell is an advanced client and code editor for MySQL. This document describes the core features of MySQL Shell. In addition to the provided SQL functionality, similar to mysql, MySQL Shell provides scripting capabilities for JavaScript and Python and includes APIs for working with MySQL. X DevAPI enables you to work with both relational and document data, see Using MySQL as a Document Store. AdminAPI enables you to work with InnoDB Cluster, see Chapter 6, Using MySQL AdminAPI.

MySQL Shell 8.0 is highly recommended for use with MySQL Server 8.0 and 5.7. Please upgrade to MySQL Shell 8.0. If you have not yet installed MySQL Shell, download it from the download site.

For notes detailing the changes in each release, see the MySQL Shell Release Notes.

For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL users.

Licensing information.  This product may include third-party software, used under license. If you are using a Commercial release of MySQL Shell, see MySQL Shell Commercial License Information User Manual for licensing information, including licensing information relating to third-party software that may be included in this Commercial release. If you are using a Community release of MySQL Shell, see MySQL Shell Community License Information User Manual for licensing information, including licensing information relating to third-party software that may be included in this Community release.

Document generated on: 2021-07-22 (revision: 70423)

Table of Contents

1 MySQL Shell Features
2 Installing MySQL Shell
2.1 Installing MySQL Shell on Microsoft Windows
2.2 Installing MySQL Shell on Linux
2.3 Installing MySQL Shell on macOS
3 Using MySQL Shell Commands
3.1 MySQL Shell Commands
4 Getting Started with MySQL Shell
4.1 Starting MySQL Shell
4.2 MySQL Shell Sessions
4.2.1 Creating the Session Global Object While Starting MySQL Shell
4.2.2 Creating the Session Global Object After Starting MySQL Shell
4.2.3 Scripting Sessions in JavaScript and Python Mode
4.3 MySQL Shell Connections
4.3.1 Connecting using Individual Parameters
4.3.2 Connecting using Unix Sockets and Windows Named Pipes
4.3.3 Using Encrypted Connections
4.3.4 Using Compressed Connections
4.4 Pluggable Password Store
4.4.1 Pluggable Password Configuration Options
4.4.2 Working with Credentials
4.5 MySQL Shell Global Objects
4.6 Using a Pager
5 MySQL Shell Code Execution
5.1 Active Language
5.2 Interactive Code Execution
5.3 Code Autocompletion
5.4 Editing Code
5.5 Code History
5.6 Batch Code Execution
5.7 Output Formats
5.7.1 Table Format
5.7.2 Tab Separated Format
5.7.3 Vertical Format
5.7.4 JSON Format Output
5.7.5 JSON Wrapping
5.7.6 Result Metadata
5.8 API Command Line Integration
5.8.1 Command Line Integration Overview
5.8.2 Command Line Integration Details
6 Using MySQL AdminAPI
6.1 MySQL AdminAPI
6.2 MySQL InnoDB Cluster
6.2.1 MySQL InnoDB Cluster Requirements
6.2.2 Deploying a Production InnoDB Cluster
6.2.3 Monitoring InnoDB Cluster
6.2.4 Working with Instances
6.2.5 Working with InnoDB Cluster
6.2.6 Configuring InnoDB Cluster
6.2.7 Troubleshooting InnoDB Cluster
6.2.8 Upgrading an InnoDB Cluster
6.2.9 Tagging the Metadata
6.2.10 InnoDB Cluster Tips
6.2.11 Known Limitations
6.3 MySQL InnoDB ReplicaSet
6.3.1 Introducing InnoDB ReplicaSet
6.3.2 Deploying InnoDB ReplicaSet
6.3.3 Adding Instances to a ReplicaSet
6.3.4 Adopting an Existing Replication Set Up
6.3.5 Working with InnoDB ReplicaSet
6.4 MySQL Router
6.4.1 Bootstrapping MySQL Router
6.4.2 Using AdminAPI and MySQL Router
6.5 AdminAPI MySQL Sandboxes
7 Extending MySQL Shell
7.1 Reporting with MySQL Shell
7.1.1 Creating MySQL Shell Reports
7.1.2 Registering MySQL Shell Reports
7.1.3 Persisting MySQL Shell Reports
7.1.4 Example MySQL Shell Report
7.1.5 Running MySQL Shell Reports
7.1.6 Built-in MySQL Shell Reports
7.2 Adding Extension Objects to MySQL Shell
7.2.1 Creating User-Defined MySQL Shell Global Objects
7.2.2 Creating Extension Objects
7.2.3 Persisting Extension Objects
7.2.4 Example MySQL Shell Extension Objects
7.3 MySQL Shell Plugins
7.3.1 Creating MySQL Shell Plugins
7.3.2 Creating Plugin Groups
7.3.3 Example MySQL Shell Plugins
8 MySQL Shell Utilities
8.1 Upgrade Checker Utility
8.2 JSON Import Utility
8.2.1 Importing JSON documents with the mysqlsh command interface
8.2.2 Importing JSON documents with the --import command
8.2.3 Conversions for representations of BSON data types
8.3 Table Export Utility
8.4 Parallel Table Import Utility
8.5 Instance Dump Utility, Schema Dump Utility, and Table Dump Utility
8.6 Dump Loading Utility
9 MySQL Shell Logging and Debug
9.1 Application Log
9.2 Verbose Output
9.3 System Logging for SQL Statements
9.4 Logging AdminAPI Operations
10 Customizing MySQL Shell
10.1 Working With Startup Scripts
10.2 Adding Module Search Paths
10.2.1 Module Search Path Environment Variables
10.2.2 Module Search Path Variable in Startup Scripts
10.3 Customizing the Prompt
10.4 Configuring MySQL Shell Options
A MySQL Shell Command Reference
A.1 mysqlsh — The MySQL Shell