Connecting to the MySQL Server
231
Connections to remote servers always use TCP/IP. This command connects to the server running on
remote.example.com
using the default port number (3306):
shell>
mysql --host=remote.example.com
To specify a port number explicitly, use the
--port
[231]
or
-P
option:
shell>
mysql --host=remote.example.com --port=13306
You can specify a port number for connections to a local server, too. However, as indicated previously,
connections to
localhost
on Unix will use a socket file by default. You will need to force a TCP/IP
connection as already described or any option that specifies a port number will be ignored.
For this command, the program uses a socket file on Unix and the
--port
[231]
option is ignored:
shell>
mysql --port=13306 --host=localhost
To cause the port number to be used, invoke the program in either of these ways:
shell>
mysql --port=13306 --host=127.0.0.1
shell>
mysql --port=13306 --protocol=TCP
The following list summarizes the options that can be used to control how client programs connect to
the server:
•
--host=host_name
[231]
,
-h host_name
The host where the server is running. The default value is
localhost
.
•
--password[=pass_val]
[231]
,
-p[pass_val]
The password of the MySQL account. As described earlier, the password value is optional, but if
given, there must be no space between
-p
or
--password=
[231]
and the password following it.
The default is to send no password.
•
--pipe
[231]
,
-W
On Windows, connect to the server using a named pipe. The server must be started with the
--
enable-named-pipe
[407]
option to enable named-pipe connections.
•
--port=port_num
[231]
,
-P port_num
The port number to use for the connection, for connections made using TCP/IP. The default port
number is 3306.
•
--protocol={TCP|SOCKET|PIPE|MEMORY}
[231]
This option explicitly specifies a protocol to use for connecting to the server. It is useful when the
other connection parameters normally would cause a protocol to be used other than the one you
want. For example, connections on Unix to
localhost
are made using a Unix socket file by default:
shell>
mysql --host=localhost
To force a TCP/IP connection to be used instead, specify a
--protocol
[231]
option:
shell>
mysql --host=localhost --protocol=TCP
The following table shows the permissible
--protocol
[231]
option values and indicates the
platforms on which each value may be used. The values are not case sensitive.
--
protocol
[231 ]
Value
Connection Protocol
Permissible Operating
Systems
TCP
TCP/IP connection to local or remote server
All
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...