MySQL Shell 8.0

Abstract

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, InnoDB ClusterSet, and InnoDB ReplicaSet.

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-12-01 (revision: 71385)

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 LDAP and Kerberos Authentication
4.3.5 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
5.9 JSON Integration
6 MySQL AdminAPI
6.1 Using MySQL AdminAPI
6.1.1 Installing AdminAPI Software Components
6.1.2 Using Instances Running MySQL 5.7
6.1.3 Configuring the Host Name
6.1.4 Connecting to Server Instances
6.1.5 Persisting Settings
6.1.6 Retrieving a Handler Object
6.1.7 Creating User Accounts for AdminAPI
6.1.8 Verbose Logging
6.1.9 Finding the Primary
6.1.10 Scripting AdminAPI
6.2 AdminAPI MySQL Sandboxes
6.2.1 Deploying Sandbox Instances
6.2.2 Managing Sandbox Instances
6.3 Tagging Metadata
6.4 Using MySQL Router with AdminAPI, InnoDB Cluster, and InnoDB ReplicaSet
6.4.1 Bootstrapping MySQL Router
6.4.2 Configuring the MySQL Router User
6.4.3 Deploying MySQL Router
6.4.4 Using ReplicaSets with MySQL Router
6.4.5 Testing InnoDB Cluster High Availability
6.4.6 Working with a Cluster's Routers
7 MySQL InnoDB Cluster
7.1 InnoDB Cluster Requirements
7.2 InnoDB Cluster Limitations
7.3 User Accounts for InnoDB Cluster
7.4 Deploying a Production InnoDB Cluster
7.4.1 Pre-Checking Instance Configuration for InnoDB Cluster Usage
7.4.2 Configuring Production Instances for InnoDB Cluster Usage
7.4.3 Creating an InnoDB Cluster
7.4.4 Adding Instances to an InnoDB Cluster
7.4.5 Configuring InnoDB Cluster Ports
7.4.6 Using MySQL Clone with InnoDB Cluster
7.4.7 Adopting a Group Replication Deployment
7.5 Configuring InnoDB Cluster
7.6 Securing InnoDB Cluster
7.7 Monitoring InnoDB Cluster
7.8 Restoring and Rebooting an InnoDB Cluster
7.9 Modifying or Dissolving an InnoDB Cluster
7.10 Upgrading an InnoDB Cluster
7.10.1 Rolling Upgrades
7.10.2 Upgrading InnoDB Cluster Metadata
7.10.3 Troubleshooting InnoDB Cluster Upgrades
8 MySQL InnoDB ClusterSet
8.1 InnoDB ClusterSet Requirements
8.2 InnoDB ClusterSet Limitations
8.3 User Accounts for InnoDB ClusterSet
8.4 Deploying InnoDB ClusterSet
8.5 Integrating MySQL Router With InnoDB ClusterSet
8.6 InnoDB ClusterSet Status and Topology
8.7 InnoDB ClusterSet Controlled Switchover
8.8 InnoDB ClusterSet Emergency Failover
8.9 InnoDB ClusterSet Repair and Rejoin
8.9.1 Inconsistent Transaction Sets (GTID Sets) in InnoDB ClusterSet Clusters
8.9.2 Repairing Member Servers and Clusters in an InnoDB ClusterSet
8.9.3 Removing a Cluster from an InnoDB ClusterSet
8.9.4 Rejoining a Cluster to an InnoDB ClusterSet
9 MySQL InnoDB ReplicaSet
9.1 Deploying InnoDB ReplicaSet
9.2 Adding Instances to a ReplicaSet
9.3 Adopting an Existing Replication Set Up
9.4 Working with InnoDB ReplicaSet
10 Extending MySQL Shell
10.1 Reporting with MySQL Shell
10.1.1 Creating MySQL Shell Reports
10.1.2 Registering MySQL Shell Reports
10.1.3 Persisting MySQL Shell Reports
10.1.4 Example MySQL Shell Report
10.1.5 Running MySQL Shell Reports
10.1.6 Built-in MySQL Shell Reports
10.2 Adding Extension Objects to MySQL Shell
10.2.1 Creating User-Defined MySQL Shell Global Objects
10.2.2 Creating Extension Objects
10.2.3 Persisting Extension Objects
10.2.4 Example MySQL Shell Extension Objects
10.3 MySQL Shell Plugins
10.3.1 Creating MySQL Shell Plugins
10.3.2 Creating Plugin Groups
10.3.3 Example MySQL Shell Plugins
11 MySQL Shell Utilities
11.1 Upgrade Checker Utility
11.2 JSON Import Utility
11.2.1 Importing JSON documents with the mysqlsh command interface
11.2.2 Importing JSON documents with the --import command
11.2.3 Conversions for representations of BSON data types
11.3 Table Export Utility
11.4 Parallel Table Import Utility
11.5 Instance Dump Utility, Schema Dump Utility, and Table Dump Utility
11.6 Dump Loading Utility
12 MySQL Shell Logging and Debug
12.1 Application Log
12.2 Verbose Output
12.3 System Logging for SQL Statements
12.4 Logging AdminAPI Operations
13 Customizing MySQL Shell
13.1 Working With Startup Scripts
13.2 Adding Module Search Paths
13.2.1 Module Search Path Environment Variables
13.2.2 Module Search Path Variable in Startup Scripts
13.3 Customizing the Prompt
13.4 Configuring MySQL Shell Options
A MySQL Shell Command Reference
A.1 mysqlsh — The MySQL Shell