MySQL Shell can be configured to connect to a MySQL Server using
command options when starting the application, or from within
MySQL Shell itself using the
command. The address of the MySQL Server which you want to connect
to can be specified using individual parameters, such as user,
hostname and port, or using a Uniform Resource Identifier (URI) in
user@host:port/schema, such as
mike@myserver:33060/testDB. The following
sections describe these connection methods.
Regardless of the method you choose to connect it is important
to understand how passwords are handled by MySQL Shell. By
default connections are assumed to require a password. The
password is requested at the login prompt. To specify a
password-less account use the
--password= option and do not
specify a password, or use a
: after the
user in a URI and do not specify a password.
If you do not specify parameters for a connection the following defaults are used:
user defaults to the current system user name
host defaults to localhost
port defaults to the X Plugin port 33060 when using an X Session, and port 3306 when using a Classic session
MySQL Shell connections using X Protocol always use TCP, using Unix sockets is not supported. MySQL Shell connections using MySQL Protocol default to using Unix sockets when the following conditions are met:
--host is specified but it is
localhost, a TCP connection is established.
In this case, if
--port is not
specified the default value of 3306 is used. If the conditions are
met for a socket connection but
--socket is not specified then the
default socket is used, see Section 4.2.2, “Connecting to the MySQL Server”.