Connecting to the Server Using URI-Like Strings or Key-Value Pairs •Connecting Using Key-Value Pairs •Connecting Using URI-Like Connection Strings •Additional Connection parameters •Base Connection Parameters •Parameters specified with key-value pairs use a syntax such as  {user:’myuser’, host:’example.com’, port:3306, schema:’main-schema’} . For the full syntax, see Connecting Using Key-Value Pairs. •Parameters specified with a URI-like string use a syntax such as  myuser@example.com:3306/main- schema . For the full syntax, see Connecting Using URI-Like Connection Strings. Connection parameters are not case-sensitive. Each parameter, if specified, can be given only once. If a parameter is specified more than once, an error occurs. This section covers the following topics: The following discussion describes the parameters available when specifying a connection to MySQL. These parameters can be provided using either a string that conforms to the base URI-like syntax (see Connecting Using URI-Like Connection Strings), or as key-value pairs (see Connecting Using Key-Value Pairs). Specifying an explicit password in the connection specification is insecure and not recommended. Later discussion shows how to cause an interactive prompt for the password to occur. 368 • schema : The default database for the connection. If no database is specified, the connection has no default database. • socket : The path to a Unix socket file or the name of a Windows named pipe. Values are local file paths. In URI-like strings, they must be encoded, using either percent encoding or by surrounding the path with parentheses. Parentheses eliminate the need to percent encode characters such as the  / directory separator character. For example, to connect as  root@localhost  using the Unix socket  / tmp/mysql.sock , specify the path using percent encoding as  root@localhost?socket=%2Ftmp %2Fmysql.sock , or using parentheses as  root@localhost?socket=(/tmp/mysql.sock) . • port : The TCP/IP network port on which the target MySQL server is listening for connections. If no port is specified, the default is 33060 for X Protocol connections and 3306 for classic MySQL protocol connections. • host : The host on which the server instance is running. The value can be a host name, IPv4 address, or IPv6 address. If no host is specified, the default is  localhost . • password : The password to use for the authentication process. • user : The MySQL user account to provide for the authentication process. • scheme : The transport protocol to use. Use  mysqlx  for X Protocol connections and  mysql  for classic MySQL protocol connections. If no protocol is specified, the server attempts to guess the protocol. Connectors that support DNS SRV can use the  mysqlx+srv  scheme (see Connections Using DNS SRV Records). Warning Base Connection Parameters