MySQL Shell 8.0

A.1 mysqlsh — The MySQL Shell

MySQL Shell is an advanced command-line client and code editor for MySQL. In addition to SQL, MySQL Shell also offers scripting capabilities for JavaScript and Python. For information about using MySQL Shell, see MySQL Shell 8.0. When MySQL Shell is connected to the MySQL Server through the X Protocol, the X DevAPI can be used to work with both relational and document data, see Using MySQL as a Document Store. MySQL Shell includes the AdminAPI that enables you to work with InnoDB Cluster, InnoDB ClusterSet, and InnoDB ReplicaSet deployments; see Chapter 6, MySQL AdminAPI.

Many of the options described here are related to connections between MySQL Shell and a MySQL Server instance. See Section 4.3, “MySQL Shell Connections” for more information.

mysqlsh supports the following command-line options.

Table A.1 mysqlsh Options

Option Name Description Introduced Deprecated
-- Start of API command line integration
--auth-method Authentication method to use
--cluster Connect to an InnoDB cluster 8.0.4
--column-type-info Print metadata for columns in result sets 8.0.14
--compress Compress all information sent between client and server 8.0.14
--connect-timeout Connection timeout for global session 8.0.13
--credential-store-helper The Secret Store helper for passwords 8.0.12
--database The schema to use (alias for --schema)
--dba Enable X Protocol on connection with MySQL 5.7 server
--dba-log-sql Log SQL statements that are executed by AdminAPI operations 8.0.18 8.0.30
--dbpassword Password to use when connecting to server 8.0.13
--dbuser MySQL user name to use when connecting to server 8.0.13
--execute Execute the command and quit
--fido-register-factor Register a FIDO device for authentication to the server 8.0.29
--file File to process in batch mode
--force Continue in SQL and batch modes even if errors occur
--get-server-public-key Request RSA public key from server
--help Display help message and exit
--histignore Strings that are not added to the history 8.0.3
--host Host on which MySQL server instance is located
--import Import JSON documents from a file or standard input 8.0.13
--interactive Emulate Interactive mode in batch mode
--js, --javascript Start in JavaScript mode
--json Print output in JSON format
--log-file Log file location for this instance 8.0.27
--log-level Specify logging level
--log-sql Log all MySQL Shell-generated SQL statements to the MySQL Shell log file. 8.0.30
-ma Detect transport protocol for session automatically 8.0.3 8.0.13
--mysql, -mc Create a session using classic MySQL protocol 8.0.3
--mysql-plugin-dir Directory where the client-side plugins are installed 8.0.27
--mysqlx, -mx Create a session using X Protocol 8.0.3
--name-cache Enable automatic loading of table names based on the active default schema 8.0.4
--no-name-cache Disable autocompletion 8.0.4
--no-password No password is provided for this connection
--no-wizard, --nw Disable the interactive wizards
--pager The external pager tool used to display output 8.0.13
--password Password to use when connecting to server
--password1 Password 1 for multifactor authentication (equivalent to --password) 8.0.28
--password2 Password 2 for multifactor authentication 8.0.28
--password3 Password 3 for multifactor authentication 8.0.28
--passwords-from-stdin Read the password from stdin
--port TCP/IP port number for connection
--py, --python Start in Python mode
--pyc Execute a Python command and quit. Any options specified after this are treated as arguments of the processed command. 8.0.31
--quiet-start Start without printing introductory information
--recreate-schema Drop and recreate schema
--redirect-primary Ensure connection to an InnoDB cluster's primary 8.0.4
--redirect-secondary Ensure connection to an InnoDB cluster's secondary
--result-format Set the output format for this session 8.0.14
--save-passwords How passwords are stored in the Secret Store 8.0.12
--schema The schema to use
--server-public-key-path Path name to file containing RSA public key
--show-warnings Show warnings after each statement if there are any (in SQL mode)
--socket Unix socket file or Windows named pipe to use (classic MySQL protocol only)
--sql Start in SQL mode, auto-detecting protocol to use for connection
--sqlc Start in SQL mode using a classic MySQL protocol connection
--sqlx Start in SQL mode using an X Protocol connection 8.0.3
--ssh URI for connection to SSH server 8.0.28
--ssh-config-file Configuration file for connection to SSH server 8.0.28
--ssh-identity-file Identity file for connection to SSH server 8.0.28
--ssl Enable an SSL connection. Deprecated in version 1.0.10; use --ssl-mode instead 8.0.3
--ssl-ca File that contains list of trusted SSL Certificate Authorities
--ssl-capath Directory that contains trusted SSL Certificate Authority certificate files
--ssl-cert File that contains X.509 certificate
--ssl-cipher Name of the SSL cipher to use
--ssl-crl File that contains certificate revocation lists
--ssl-crlpath Directory that contains certificate revocation list files
--ssl-key File that contains X.509 key
--ssl-mode Desired security state of connection to server
--syslog Log interactive SQL statements to the system logging facility 8.0.24
--tabbed Display output in tab separated format
--table Display output in table format
--tls-version Permissible TLS protocol for encrypted connections
--uri Session information in URI format
--user MySQL user name to use when connecting to server
--verbose Activate verbose output to the console 8.0.17
--version Display version information and exit
--vertical Display all SQL results vertically