Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 37.5Mb
PDF (A4) - 37.5Mb
PDF (RPM) - 36.9Mb
HTML Download (TGZ) - 10.2Mb
HTML Download (Zip) - 10.2Mb
HTML Download (RPM) - 8.9Mb
Man Pages (TGZ) - 211.3Kb
Man Pages (Zip) - 321.0Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

18.2.2.1 Connecting using a URI String

You configure the MySQL Server which MySQL Shell connects to by passing the connection data in string format using the --uri command-line option.

Use the following format:

[dbuser[:[dbpassword]]@]host[:port][/schema]

Descriptions of these options:

  • dbuser: specifies the MySQL user account to be used for the authentication process.

  • dbpassword: specifies the dbuser password to be used for the authentication process.

    Warning

    Storing the password in the URI is not recommended.

  • host: specifies the host to which the session object connects. If not specified, localhost is used by default.

  • port: specifies which port the target MySQL server is listening on for the connection. If not specified, 33060 is used by default for the X Protocol enabled sessions, and 3306 is the default for traditional MySQL protocol sessions.

  • schema: Indicates the database to be set as default when the session is established.

If no password is specified using the URI, which is recommended, then the password is prompted for. The following examples show how to use these command-line options:

  • Connect with a Node Session at port 33065.

    shell> mysqlsh --uri user@localhost:33065 --node
    
  • Connect with a Classic Session.

    shell> mysqlsh --uri user@localhost --classic
    

Although using a password-less account is not recommended, you can specify a user without a password using a : after the user name, for example:

shell> mysqlsh --uri user:@localhost

In addition to specifying a URI manually, you can use a stored session. See Section 18.5, “Stored Sessions” for more information.


User Comments
Sign Up Login You must be logged in to post a comment.