MySQL Shell 8.0
In addition to specifying connection parameters using a connection string, it is also possible to define the connection data when starting MySQL Shell using separate command parameters for each value. For a full reference of MySQL Shell command options see Section A.1, “mysqlsh — The MySQL Shell”.
Use the following connection related parameters:
The command options behave similarly to the options used with the mysql client described at Connecting to the MySQL Server Using Command Options.
Use the following command options to control whether and how a password is provided for the connection:
            --password=
            (password-p)
            with a value supplies a password (up to 128 characters) to
            be used for the connection. With the long form
            password--password=, you must use an equal 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 be
            interpreted as another connection parameter.
          
Specifying a password on the command line should be considered insecure. See End-User Guidelines for Password Security. You can use an option file to avoid giving the password on the command line.
            --password with no value and
            no equal sign, or -p without a value,
            requests the password prompt.
          
            --no-password, or
            --password= with an empty
            value, 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,
            --password2, and
            --password3,
            available from MySQL Shell 8.0.28, are the passwords for
            accounts that require multifactor authentication. You can
            supply up to three passwords. The options work in the same
            way as the --password option, and --password1 is treated as
            equivalent to that option. These options are available from
            MySQL Shell 8.0.28, where they are only supported for
            classic MySQL protocol connections made using command-line
            arguments.
          
        When parameters are specified in multiple ways, for example
        using both the --uri option and
        specifying individual parameters such as
        --user, the following rules
        apply:
      
If an argument is specified more than once the value of the last appearance is used.
            If both individual connection arguments and
            --uri are specified, the
            value of --uri is taken as
            the base and the values of the individual arguments override
            the specific component from the base URI-like string.
          
            For example to override user from
            the URI-like string:
          
$> mysqlsh --uri user@localhost:33065 --user otheruser
Connections from MySQL Shell to a server can be encrypted, and can be compressed, if you request these features and the server supports them. For instructions to establish an encrypted connection, see Section 4.3.4, “Using Encrypted Connections”. For instructions to establish a compressed connection, see Section 4.3.7, “Using Compressed Connections”.
The following examples show how to use command parameters to specify connections. Attempt to establish an X Protocol connection with a specified user at port 33065:
$> mysqlsh --mysqlx -u user -h localhost -P 33065
Attempt to establish a classic MySQL protocol connection with a specified user, requesting compression for the connection:
$> mysqlsh --mysql -u user -h localhost -C