MYSQLSH(1)

๐Ÿ“ฆ
version 9.7.1 ยท 5 versions
, in nixpkgs unstable, ubuntu stonking

โœจ MYSQLSH(1) โœจ

okay so this is the MySQL Database System manual page for mysqlsh, bestie. buckle up. ๐ŸŽ€

๐ŸŒธ NAME ๐ŸŒธ

mysqlsh โ€” the MySQL shell. periodt. ๐Ÿ‘‘

๐Ÿ“œ SYNOPSIS ๐Ÿ“œ

mysqlsh [options] db_name

๐Ÿ’– DESCRIPTION ๐Ÿ’–

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[1]. 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.

โœจ the options, one by one โœจ

  • --help, -? โ€” Display a help message and exit. so you can dip with the cheat sheet if you need it ๐Ÿ’…
  • -- โ€” Marks the end of the list of mysqlsh options and the start of a command and its arguments for MySQL Shell's API command line integration. You can execute methods of the MySQL Shell global objects from the command line using this syntax:
mysqlsh [options]  -- object method [arguments]

See Section 5.8, โ€œAPI Command Line Integrationโ€ for more information.

  • --auth-method=method โ€” Authentication method to use for the account. Depends on the authentication plugin used for the account's password. For MySQL Shell connections using classic MySQL protocol, specify the name of the authentication plugin, for example caching_sha2_password. For MySQL Shell connections using X Protocol, specify one of the following options:
    • AUTO โ€” Let the library select the authentication method.
    • FALLBACK โ€” Let the library select the authentication method, but do not use any authentication method that is not compatible with MySQL 5.7.
    • FROM_CAPABILITIES โ€” Let the library select the authentication method, using the capabilities announced by the server instance.
    • MYSQL41 โ€” Use the challenge-response authentication protocol supported by MySQL 4.1 and later, which does not send a plaintext password. This option is compatible with accounts that use the mysql_native_password authentication plugin.
    • PLAIN โ€” Send a plaintext password for authentication. Use this option only with encrypted connections. This option can be used to authenticate with cached credentials for an account that uses the caching_sha2_password authentication plugin, provided there is an SSL connection. See Using X Plugin with the Caching SHA-2 Authentication Plugin[2].
    • SHA256_MEMORY โ€” Authenticate using a hashed password stored in memory. This option can be used to authenticate with cached credentials for an account that uses the caching_sha2_password authentication plugin, where there is a non-SSL connection. See Using X Plugin with the Caching SHA-2 Authentication Plugin[2].

For MySQL Shell connections using classic MySQL protocol, specify the name of the authentication plugin used by the user account, for example caching_sha2_password (which is the default for user accounts created in MySQL 8.0). MySQL Shell uses the MySQL client library for client-side authentication for these connections. The following authentication methods require additional configuration:

  • clear_text_password โ€” The mysql_clear_password client-side plugin is required for simple LDAP authentication. It is built in to the MySQL client library, but for security it is not enabled by default. From MySQL Shell 8.0.27, MySQL Shell enables and uses the plugin when you specify it with the --auth-method=clear_text_password connection option. This authentication type is only suitable for a secure connection that uses SSL or sockets, so you must configure the secure connection before using it. Note that with the option ssl-mode=preferred, the SSL connection is not guaranteed, so a connection with this option set is not considered to be an SSL connection. For more information, see Section 4.3.4, โ€œUsing Encrypted Connectionsโ€.
  • authentication_ldap_sasl_client โ€” The authentication_ldap_sasl_client client-side plugin is for SASL-based LDAP authentication, including GSSAPI/Kerberos authentication. It is not built in to the MySQL client library, but it is shipped in the MySQL Server packages. To load it, you must use the --mysql-plugin-dir option (available from MySQL Shell 8.0.27) to specify a path to the plugin in the MySQL Server packages.
  • authentication_kerberos_client โ€” The authentication_kerberos_client client-side plugin is for Kerberos authentication. It is not built in to the MySQL client library, but it is shipped in the MySQL Server packages. To load it, you must use the --mysql-plugin-dir option (available from MySQL Shell 8.0.27) to specify a path to the plugin in the MySQL Server packages.

Cached ticket-granting tickets (TGTs) for Kerberos authentication are supported from MySQL 8.0.27 when the --auth-method option is used to specify the authentication_ldap_sasl_client or authentication_kerberos_client plugin, and the --mysql-plugin-dir option is used to provide a path to the plugin. To use cached TGTs, do not specify a user and password in the connection options. When you specify one of these plugins and do not specify a user and password, MySQL Shell does not supply the system user name, does not prompt for a password, and does not attempt to use the Secret Store helper to retrieve or store credentials.

For more information, see Section 4.3.5, โ€œUsing LDAP and Kerberos Authenticationโ€.

  • --cluster โ€” Ensures that the target server is part of an InnoDB Cluster and if so, sets the cluster global variable to the cluster object.
  • --column-type-info โ€” In SQL mode, before printing the returned result set for a query, print metadata for each column in the result set, such as the column type and collation.

The column type is returned as both the type used by MySQL Shell (Type), and the type used by the original database (DBType). For MySQL Shell connections using classic MySQL protocol, DBType is as returned by the protocol, and for X Protocol connections, DBType is inferred from the available information. The column length (Length) is returned in bytes.

  • --compress[={required|preferred|disabled}], -C [{required|preferred|disabled}] โ€” Controls compression of information sent between the client and the server using this connection. In MySQL Shell 8.0.14 through 8.0.19 this option is available for classic MySQL protocol connections only, and does not use the options required, preferred, and disabled. In those releases, when you specify --compress, compression is activated if possible. From MySQL Shell 8.0.20 it is also available for X Protocol connections, and you can optionally specify required, preferred, or disabled. When just --compress is specified from MySQL Shell 8.0.20, the meaning is --compress=required. See Section 4.3.7, โ€œUsing Compressed Connectionsโ€ for information on using MySQL Shell's compression control in all releases.
  • --compression-algorithms=value โ€” The permitted compression algorithms for connections to the server.
    • Command-Line Format: --compression-algorithms=value
    • Introduced: 8.0.18
    • Type: Set
    • Default Value: uncompressed
    • Valid Values: zlib, zstd, uncompressed

See Section 4.3.7.1, โ€œCompression Control For MySQL Shell 8.0.20 And Laterโ€.

  • --compression-level=level โ€” Compression level for connections to server that use any compression algorithm over X Protocol or for zstd only on classic connections.
    • Command-Line Format: --zstd-compression-level=#
    • Introduced: 8.0.18
    • Type: Integer

See Section 4.3.7.1, โ€œCompression Control For MySQL Shell 8.0.20 And Laterโ€.

  • --zstd-compression-level=level

Okay so bestie, this one is about how hard zstd should squeeze your connection data ๐Ÿ’–

  • Command-Line Format: --zstd-compression-level=#
  • Introduced: 8.0.18
  • Type: Integer

The compression level to use for connections to the server that use the zstd compression algorithm. The permitted levels are from 1 to 22, with larger values indicating increasing levels of compression ๐Ÿ”ฅ The default zstd compression level is 3. The compression level setting has no effect on connections that do not use zstd compression (so don't stress about it if zstd isn't your vibe).

See Section 4.3.7.1, โ€œCompression Control For MySQL Shell 8.0.20 And Laterโ€.

  • --connect-timeout=ms โ€” Configures how long MySQL Shell waits (in milliseconds) to establish a global session specified through command-line arguments โฑ๏ธ
  • --credential-store-helper=helper โ€” The Secret Store Helper that is to be used to store and retrieve passwords ๐Ÿ” See Section 4.4, โ€œPluggable Password Storeโ€.
  • --database=name, -D name โ€” The default schema to use. This is an alias for --schema ๐Ÿ’…
  • --dba=enableXProtocol โ€” Enable X Plugin on connection with a MySQL 5.7 server, so that you can use X Protocol connections for subsequent connections. Requires a connection using classic MySQL protocol ๐Ÿซถ Not relevant for MySQL 8.0 servers, which have X Plugin enabled by default (they're already iconic like that).
  • --dba-log-sql[=0|1|2] โ€” Log SQL statements that are executed by AdminAPI operations (excluding sandbox operations). By default, this category of statement is not written to the MySQL Shell application log file or sent to the console as verbose output, even when the --log-level and --verbose options are set. The value of the option is an integer in the range from 0 to 2 ๐Ÿงš
    • 0 does not log or display this category of statement, which is the default behavior if you do not specify the option.
    • 1 logs SQL statements that are executed by AdminAPI operations, with the exceptions of SELECT statements and SHOW statements (this is the default setting if you specify the option on the command line without a value).
    • 2 logs SQL statements that are executed by regular AdminAPI operations in full, including SELECT and SHOW statements.

See Chapter 12, MySQL Shell Logging and Debug for more information.

  • --log-sql[=off|error|on|all|unfiltered] โ€” Log all SQL statements executed by MySQL Shell to the MySQL Shell log file, mysqlsh.log ๐Ÿ“

The following options are available:

  • off โ€” No MySQL Shell SQL statements are logged.
  • error โ€” (Default value) only MySQL Shell failed SQL statements with are logged. (yes that's exactly what it says, we don't make the rules)
  • on โ€” All MySQL Shell SQL statements are logged, except those which match the ignore pattern defined in logSql.ignorePattern and logSql.ignorePatternUnsafe. See the section called โ€œFiltering SQL Loggingโ€ for more information.
  • all โ€” All MySQL Shell SQL statements are logged, except those which match the ignore pattern defined in logSql.ignorePatternUnsafe. See the section called โ€œFiltering SQL Loggingโ€ for more information.
  • unfiltered โ€” All MySQL Shell SQL statements are logged, no filtering is performed ๐Ÿ˜ญ
  • --dbpassword[=password] โ€” Deprecated in version 8.0.13 of MySQL Shell. Use --password[=password] instead. (bestie it's giving โœจretiredโœจ)
  • --dbuser=user_name โ€” Deprecated in version 8.0.13 of MySQL Shell. Use --user=user_name instead.
  • --execute=command, -e command โ€” Execute the command using the currently active language and quit. This option is mutually exclusive with the --file=file_name option ๐Ÿ‘‘
  • --fido-register-factor โ€” The factor or factors for which FIDO device registration must be performed. This option value must be a single value, or two values separated by commas. Each value must be 2 or 3, so the permitted option values are '2', '3', '2,3' and '3,2' ๐Ÿ”‘

For example:

mysqlsh --user=user_name --password1 --fido-register-factor=2
Enter password: (enter factor 1 password)

To register an account for passwordless authentication, with the FIDO device being the only authentication, you use --fido-register-factor=2 to provide the temporary password. The server moves FIDO authentication to the first factor after registration succeeds.

Note ๐Ÿ’– MySQL Shell prompts for a password if you do not specify one when connecting to the server. After you set up passwordless authentication with a FIDO device, use one of the following methods to bypass the password prompt when you make a connection: - Specify the connection option --no-password, or --password= with an empty value. - Place a colon (:) after the user name in the connection string, for example: mysqlsh user_name:@localhost - Press Enter when the password prompt appears.

MySQL Shellโ€™s --fido-register-factor option works in the same way as the mysql client option. For more details and instructions, see FIDO Pluggable Authentication[3].

  • --file=file_name, -f file_name โ€” Specify a file to process in Batch mode. Any options specified after this are used as arguments of the processed file ๐Ÿ“‚
  • --force โ€” Continue processing in SQL and Batch modes even if errors occur ๐Ÿ’€
  • --histignore=strings โ€” Specify strings that are not added to the MySQL Shell history ๐ŸŒธ Strings are separated by a colon. Matching is case insensitive, and the wildcards * and ? can be used. The default ignored strings are specified as โ€œ*IDENTIFIED*:*PASSWORD*โ€. See Section 5.5, โ€œCode Historyโ€.
  • --host=host_name, -h host_name โ€” Connect to the MySQL server on the given host ๐ŸŒˆ On Windows, if you specify --host=. or -h . (giving the host name as a period), MySQL Shell connects using the default named pipe (which has the name MySQL), or an alternative named pipe that you specify using the --socket option.
  • --get-server-public-key โ€” MySQL Shell equivalent of --get-server-public-key ๐Ÿ’ซ

If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over --get-server-public-key.

Important โš ๏ธ Only supported with classic MySQL protocol connections.

See Caching SHA-2 Pluggable Authentication[4].

  • --import โ€” Import JSON documents from a file or standard input to a MySQL Server collection or relational table, using the JSON import utility ๐Ÿ“ For instructions, see Section 11.2, โ€œJSON Import Utilityโ€.
  • --interactive[=full], -i โ€” Emulate Interactive mode in Batch mode ๐ŸŽ€
  • --js, --javascript โ€” Start in JavaScript mode โœจ
  • --json[={off|pretty|raw}] โ€” Controls JSON wrapping for MySQL Shell output from this session. This option is intended for interfacing MySQL Shell with other programs, for example as part of testing ๐Ÿงช For changing query results output to use the JSON format, see --result-format.

When the --json option has no value or a value of pretty, the output is generated as pretty-printed JSON. With a value of raw, the output is generated in raw JSON format. In any of these cases, the --result-format option and its aliases and the value of the resultFormat MySQL Shell configuration option are ignored. With a value of off, JSON wrapping does not take place, and result sets are output as normal in the format specified by the --result-format option or the resultFormat configuration option.

  • --log-file=path โ€” Change the location of the MySQL Shell application log file mysqlsh.log for this MySQL Shell instance ๐Ÿ“ The default location for the application log file is the user configuration path, which defaults to %APPDATA%\MySQL\mysqlsh\ on Windows or ~/.mysqlsh/ on Unix. You can override the user configuration path for all MySQL Shell instances by defining the environment variable MYSQLSH_USER_CONFIG_HOME. The --log-file option applies to the individual MySQL Shell instance, meaning that different instances can write to different locations ๐Ÿ‘ฏ
  • --log-level=N โ€” Change the logging level for the MySQL Shell application log file mysqlsh.log, or disable logging to the file. The option requires a value, which can be either an integer in the range from 1 to 8, or one of none, internal, error, warning, info, debug, debug2, or debug3 ๐Ÿ’œ Specifying 1 or none disables logging to the application log file. Level 5 (info) is the default if you do not specify this option. See Chapter 12, MySQL Shell Logging and Debug.
  • -ma โ€” Deprecated in version 8.0.13 of MySQL Shell. Automatically attempts to use X Protocol to create the session's connection, and falls back to classic MySQL protocol if X Protocol is unavailable ๐Ÿ™ˆ
  • --mysql, --mc โ€” Sets the global session created at start up to use a classic MySQL protocol connection ๐Ÿ‘‘ The --mc option with two hyphens replaces the previous single hyphen -mc option from MySQL Shell 8.0.13.
  • --mysql-plugin-dir=path โ€” Sets a non-persistent path to the client-side authentication plugins by overriding the value of the shell.options.mysqlPluginDir setting ๐Ÿ”Œ Client-side plugins are shipped in the MySQL Server packages and can be located relative to the MySQL base directory (the value of the basedir system variable). For example:
    • C:\program files\mysql\mysql Server 8.0\lib\plugin on Windows host types
    • /usr/local/mysql/lib/plugin on Linux host types

For a list of the client authentication plugins that ship with the server, see Available Authentication Plugins[5].

  • --mysqlx, --mx

Sets the global session created at start up to use an X Protocol connection. The --mx option with two hyphens replaces the previous single hyphen -mx option from MySQL Shell 8.0.13.

  • --name-cache โ€” turns on auto-loading of table names that's based on whatever your active default schema is. cozy autocomplete vibes ๐Ÿ’–
  • --no-name-cache, -A โ€” kills the table-name loading for autocompletion (the kind based on your active default schema and the DevAPI db object). Wanna reload the name info by hand later? Just use \rehash. manual mode, bestie โœจ
  • --no-password โ€” okay so when you're connecting to the server, if the user has a passwordless account (which is insecure and genuinely not recommended, ngl) โ€” or if socket peer-credential authentication is in play (that's for Unix socket connections) โ€” you must use --no-password to explicitly say out loud that no password is being provided and the password prompt is not needed. no guessing games. say it with your chest ๐Ÿ’…
  • --no-wizard, -nw โ€” disables the interactive wizards from operations like creating connections, dba.configureInstance(), Cluster.rebootClusterFromCompleteOutage() and so on. Reach for this one when you wanna script MySQL Shell and not have those interactive prompts popping up. for more info see Section 5.6, โ€œBatch Code Executionโ€ and Section 5.8, โ€œAPI Command Line Integrationโ€. no pop-ups, just vibes ๐Ÿงš
  • --pager=name โ€” the external pager tool that MySQL Shell uses to display text output for statements run in SQL mode, plus other selected commands like online help. If you don't set a pager, then the pager named by the PAGER environment variable gets used. see Section 4.6, โ€œUsing a Pagerโ€. scroll in style ๐Ÿ“œ
  • --passwords-from-stdin โ€” reads the password from standard input instead of from the terminal. heads up tho: this option does not touch any other password behavior, like the password prompt. one job only ๐Ÿซถ
  • --password[=password], -ppassword โ€” the password you use when connecting to the server. The maximum password length accepted for connecting to MySQL Shell is 128 characters. 128 chars, that's the limit fr
    • --password=password (-ppassword) with a value supplies a password to use for the connection. With the long form --password=, you must use an equals sign and not a space between the option and its value. With the short form -p, there must be no space between the option and its value. If a space is used in either case, the value is not interpreted as a password and might get interpreted as another connection parameter. spaces = chaos, avoid ๐Ÿ˜ญ

Specifying a password on the command line should be considered insecure. See End-User Guidelines for Password Security[6]. You can use an option file to avoid giving the password on the command line. pls don't type secrets in the open ๐Ÿ™ˆ

  • --password with no value and no equal sign, or -p without a value, requests the password prompt. prompt era ๐Ÿ’–
  • --password= with an empty value has the same effect as --no-password, which specifies that the user is connecting without a password. When connecting to the server, if the user has a passwordless account โ€” which is insecure and not recommended โ€” or if socket peer-credential authentication is in use (for Unix socket connections), you must use one of these methods to explicitly specify that no password is provided and the password prompt is not required.
  • --password1[=password] โ€” so --password1, --password2 and --password3 are the passwords for accounts that require multifactor authentication. You can supply up to three passwords. These options work the same way as the --password option, and --password1 is treated as equivalent to that option. You can either drop a password value right after the option on the command line (which is insecure, ngl ๐Ÿ˜ฌ) โ€” or, if the options are given without a password value, MySQL Shell prompts the user for each password in turn. These options are available from MySQL Shell 8.0.28, where they're only supported for classic MySQL protocol connections made using command-line arguments. triple password, triple slay ๐Ÿ‘‘
  • --password2[=password] โ€” the password for the second authentication method for accounts that require multifactor authentication. see the description for the --password1 option. โœจ
  • --password3[=password] โ€” the password for the third authentication method for accounts that require multifactor authentication. see the description for the --password1 option. โœจ
  • --port=port_num, -P port_num โ€” the TCP/IP port number to use for the connection. The default is port 33060. port 33060, iconic ๐Ÿ”ฅ
  • --py, --python โ€” start in Python mode. ๐Ÿ snake time
  • --pyc=pythonCommand, -c โ€” execute a Python command and quit. Any options you specify after this get treated as arguments of the processed command.
  • --pym โ€” execute the specified Python module as a script in MySQL Shell's Python mode. --pym works the same way as Python's -m command line option. This option is available from MySQL Shell 8.0.22. python -m energy, periodt ๐Ÿ’…
  • --quiet-start[=1|2] โ€” start without printing the introductory info. Normally MySQL Shell prints product info, session info (like the default schema and connection ID), warning messages, and any errors returned during startup and connection. When you pass --quiet-start with no value or a value of 1, the info about the MySQL Shell product isn't printed, but session info, warnings, and errors still are. With a value of 2, only errors get printed. less chatter, more focus โœจ
  • --recreate-schema โ€” drop and recreate the schema specified in the connection options, whether it came as part of a URI-like connection string or via the --schema, --database, or -D option. The schema is deleted if it exists. it's GONE gone โ€” careful bestie ๐Ÿ’€
  • --redirect-primary โ€” makes sure the target server is part of an InnoDB Cluster or InnoDB ReplicaSet, and if it isn't the primary, finds the primary and connects to it. MySQL Shell exits with an error if any of these is true when using this option:
    • No instance is specified
    • On an InnoDB Cluster, Group Replication is not active
    • InnoDB Cluster metadata does not exist
    • There is no quorum
  • --replicaset โ€” makes sure the target server belongs to an InnoDB ReplicaSet, and if so, populates the rs global variable with the InnoDB ReplicaSet. Then you can administer the InnoDB ReplicaSet with that rs global variable, like by running rs.status(). main character rs variable ๐Ÿ’–
  • --redirect-secondary โ€” makes sure the target server is part of a single-primary InnoDB Cluster or InnoDB ReplicaSet, and if it isn't a secondary, finds a secondary and connects to it. MySQL Shell exits with an error if any of these is true when using this option:
    • On an InnoDB Cluster, Group Replication is not active
    • InnoDB Cluster metadata does not exist
    • There is no quorum
    • The cluster is not single-primary and is running in multi-primary mode
    • There is no secondary available, for example because there is just one server instance
  • --result-format={table|tabbed|vertical|json|json/pretty|ndjson|json/raw|json/array} โ€” sets the value of the resultFormat MySQL Shell configuration option for this session. The formats are as follows:
    • table โ€” the default for interactive mode, unless another value has been set persistently for the resultFormat configuration option in the configuration file, in which case that default applies. The --table alias can also be used. ๐ŸŽ€
    • tabbed โ€” the default for batch mode, unless another value has been set persistently for the resultFormat configuration option in the configuration file, in which case that default applies. The --tabbed alias can also be used. ๐ŸŽ€
    • vertical โ€” produces output equivalent to the \G terminator for an SQL query. The --vertical or -E aliases can also be used.
    • json or json/pretty โ€” produces pretty-printed JSON. โœจ
    • ndjson or json/raw โ€” produces raw JSON delimited by newlines.
    • json/array โ€” produces raw JSON wrapped in a JSON array.

If the --json command line option is used to activate JSON wrapping for output for the session, then the --result-format option and its aliases and the value of the resultFormat configuration option are all ignored. yeah they get ghosted ๐Ÿ‘ป

  • --save-passwords={always|prompt|never} โ€” controls whether passwords are automatically stored in the secret store. always means passwords are always stored unless they're already in the store or the server URL is excluded by a filter. never means passwords are never stored. prompt, which is the default, means users are asked whether to store the password or not. see Section 4.4, โ€œPluggable Password Storeโ€. secret store shenanigans ๐Ÿซถ
  • --schema=name, -D name โ€” the default schema to use.
  • --server-public-key-path=file_name โ€” MySQL Shell equivalent of --server-public-key-path.

If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over --get-server-public-key. it wins, no cap ๐Ÿ‘‘

Important Only supported with classic MySQL protocol connections.

See caching_sha2_password plugin Caching SHA-2 Pluggable Authentication[4]. ๐Ÿ”

  • --show-warnings={true|false} โ€” when true is specified, which is the default, in SQL mode MySQL Shell displays warnings after each SQL statement if there are any. If false is specified, warnings are not displayed. your call bestie ๐Ÿ’…
  • --socket[=path], -S [path] โ€” on Unix, when a path is specified, that path is the name of the Unix socket file to use for the connection. If you specify --socket with no value and no equal sign, or -S without a value, the default Unix socket file for the appropriate protocol is used.

On Windows, the path is the name of the named pipe to use for the connection. The pipe name is not case-sensitive. On Windows, you must specify a path, and the --socket option is available for classic MySQL protocol sessions only. windows rules hit different ๐Ÿ“

You can't specify a socket if you specify a port or a host name other than localhost on Unix, or a period (.) on Windows. pick a lane, bestie ๐Ÿ˜ญ

  • --sql

okay so starting in SQL mode, MySQL Shell will literally auto-detect which protocol to use if you don't spell it out in the connection info ๐ŸŒธ. When the protocol isn't specified, it defaults to an X Protocol connection and then falls back to a classic MySQL protocol connection, bestie. Wanna force a specific one? That's what --sqlx or --sqlc are for. Or you can just name the protocol inside a URI-like connection string, or use the --port option. Full deets live in Section 4.3, โ€œMySQL Shell Connectionsโ€ and MySQL Shell Ports[7]. ๐Ÿ’…

  • --sqlc โ€” kicks things off in SQL mode and forces the connection to use the classic MySQL protocol. Use this when you need MySQL Shell to talk to a server that doesn't do X Protocol. If you don't stick a port in the connection info, MySQL Shell grabs the default classic MySQL protocol port, which is usually 3306. The port you're connecting to has to support classic MySQL protocol โ€” so fr, if the connection you gave uses the X Protocol default port 33060, the connection fails with an error, no cap ๐Ÿ˜ญ. More info in Section 4.3, โ€œMySQL Shell Connectionsโ€ and MySQL Shell Ports[7].
  • --sqlx โ€” starts in SQL mode and forces the connection to use X Protocol. No port in your connection info? MySQL Shell uses the default X Protocol port, usually 33060. And yeah, the port you're connecting to must support X Protocol โ€” so if your connection uses the classic MySQL protocol default port 3306, it fails with an error ๐Ÿ’€. See Section 4.3, โ€œMySQL Shell Connectionsโ€ and MySQL Shell Ports[7].
  • --ssh=str โ€” builds an SSH tunnel so your connection to the MySQL server instance is encrypted ๐Ÿ”’. Hand over the URI for connecting to the SSH server in the format [user@]host[:port], like:
--ssh root@198.51.100.4:2222

When you use this one you also have to give the --user, --host, and --port options, or a URI, for the connection to the MySQL server instance. SSH tunnel tea is all in Section 4.3.6, โ€œUsing an SSH Tunnelโ€.

  • --ssh-config-file=path โ€” points at the path to an SSH config file for the SSH server connection. You can use the MySQL Shell configuration option ssh.configFile to set a custom file as the default when this option isn't given. If ssh.configFile isn't set, the default is the standard SSH config file ~/.ssh/config ๐Ÿš. And if you pass --ssh-config-file with an empty value, the default file from ssh.configFile gets ignored and ~/.ssh/config is used instead.
  • --ssh-identity-file=path โ€” gives the path to an identity file for the SSH server connection. Don't specify it? Then the default is the standard private key file in the SSH config folder, ~/.ssh/id_rsa ๐ŸŽ€.
  • --ssl* โ€” every option starting with --ssl says whether to connect to the server using SSL and tells you where the SSL keys and certificates are hiding. The mysqlsh SSL options behave exactly like the SSL options for MySQL Server โ€” see Command Options for Encrypted Connections[8] for more.

mysqlsh accepts these SSL options: --ssl-mode, --ssl-ca, --ssl-capath, --ssl-cert, --ssl-cipher, --ssl-crl, --ssl-crlpath, --ssl-key, --tls-version, --tls-ciphersuites.

  • --syslog โ€” sends the SQL statements you run in MySQL Shell's SQL mode off to your operating system's system logging facility (syslog on Unix, or the Windows Event Log) ๐Ÿ“. Heads up tho: system logging for SQL statements only happens when MySQL Shell is started in interactive mode โ€” so a normal start, or a start with the --interactive option. It does not happen if you use --execute or --file at startup to run mysqlsh in batch mode. See Section 12.3, โ€œSystem Logging for User SQL Statementsโ€.
  • --tabbed โ€” shows results in tab separated format in interactive mode (the default for that mode is table format). This one's an alias of --result-format=tabbed โœจ.
  • --table โ€” shows results in table format in batch mode (the default for that mode is tab separated format). Alias of --result-format=table, bestie ๐Ÿซถ.
  • --uri=str โ€” creates a connection on startup, with the connection options handed over in a URI-like string, just like it says at Connecting to the Server Using URI-Like Strings or Key-Value Pairs[9].
  • --user=user_name, -u user_name โ€” the MySQL user name to use when connecting to the server. That's it, that's the whole vibe ๐Ÿ™ˆ.
  • --verbose[=0|1|2|3|4] โ€” turns on verbose output to the console and sets how much detail you get. The value is an integer from 0 to 4. 0 shows no messages at all, and that's the default verbosity when you don't specify the option. 1 shows error, warning and informational messages โ€” and that's the default when you put the option on the command line with no value. 2, 3, and 4 pile on higher levels of debug messages ๐Ÿ”ฅ. More in Chapter 12, MySQL Shell Logging and Debug.
  • --version, -V โ€” displays the version of MySQL Shell and dips ๐Ÿ‘‹.
  • --vertical, -E โ€” displays results vertically, like when you use the \G terminator for an SQL query. Alias of --result-format=vertical ๐Ÿ’œ.

Copyright ยฉ 2006, 2026, Oracle and/or its affiliates.

This documentation is free software โ€” you can redistribute it and/or modify it, but only under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License ๐Ÿ“œ.

This documentation is distributed hoping it'll be useful, but WITHOUT ANY WARRANTY โ€” not even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE ๐Ÿ˜ญ. See the GNU General Public License for the full deets.

You should have received a copy of the GNU General Public License along with the program. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or peep http://www.gnu.org/licenses/.


๐Ÿฆ‹ NOTES ๐Ÿฆ‹

  1. Using MySQL as a Document Store โ€” https://dev.mysql.com/doc/refman/8.0/en/document-store.html
  2. Using X Plugin with the Caching SHA-2 Authentication Plugin โ€” https://dev.mysql.com/doc/refman/8.0/en/x-plugin-sha2-cache-plugin.html
  3. FIDO Pluggable Authentication โ€” https://dev.mysql.com/doc/refman/8.0/en/fido-pluggable-authentication.html
  4. Caching SHA-2 Pluggable Authentication โ€” https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html
  5. Available Authentication Plugins โ€” https://dev.mysql.com/doc/refman/8.0/en/pluggable-authentication.html#pluggable-authentication-available-plugins
  6. End-User Guidelines for Password Security โ€” https://dev.mysql.com/doc/refman/8.0/en/password-security-user.html
  7. MySQL Shell Ports โ€” https://dev.mysql.com/doc/mysql-port-reference/en/mysql-port-reference-tables.html#GUID-65C1FF7E-5357-4E58-8D68-A0C3D24C0832__MYSQL-SHELL-PORTS
  8. Command Options for Encrypted Connections โ€” https://dev.mysql.com/doc/refman/8.0/en/connection-options.html#encrypted-connection-options
  9. Connecting to the Server Using URI-Like Strings or Key-Value Pairs โ€” https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Oracle Corporation (http://dev.mysql.com/).


and that's a wrap on the whole page, bestie ๐Ÿ’…๐ŸŒธ you just read the MySQL 8.0 manual page for MYSQLSH(1), dated 06/09/2026 โ€” go forth and connect, you absolute icon ๐Ÿซถ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from