Oracle 5.0 Reference Manual page 250

Table of Contents

Advertisement

shell>
mysql
Because there are no parameter options, the default values apply:
• The default host name is localhost. On Unix, this has a special meaning, as described later.
• The default user name is
• No password is sent if neither
• For mysql, the first nonoption argument is taken as the name of the default database. If there is no
such option,
mysql
To specify the host name and user name explicitly, as well as a password, supply appropriate options
on the command line:
shell>
mysql --host=localhost --user=myname --password=mypass mydb
shell>
mysql -h localhost -u myname -pmypass mydb
For password options, the password value is optional:
• If you use a
or
-p
--password
space between
or
-p
• If you use a
or
-p
--password
program prompts you to enter the password. The password is not displayed as you enter it. This is
more secure than giving the password on the command line. Other users on your system may be
able to see a password specified on the command line by executing a command such as
See
Section 6.1.2.1, "End-User Guidelines for Password
As just mentioned, including the password value on the command line can be a security risk. To avoid
this problem, specify the
shell>
mysql --host=localhost --user=myname --password mydb
shell>
mysql -h localhost -u myname -p mydb
When the password option has no password value, the client program prints a prompt and waits for
you to enter the password. (In these examples,
separated from the preceding password option by a space.)
On some systems, the library routine that MySQL uses to prompt for a password automatically limits
the password to eight characters. That is a problem with the system library, not with MySQL. Internally,
MySQL does not have any limit for the length of the password. To work around the problem, change
your MySQL password to a value that is eight or fewer characters long, or put your password in an
option file.
On Unix, MySQL programs treat the host name
from what you expect compared to other network-based programs. For connections to localhost,
MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even
if a
[231]
or
--port
-P
a TCP/IP connection to the local server, use
of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection
protocol explicitly, even for localhost, by using the
shell>
mysql --host=127.0.0.1
shell>
mysql --protocol=TCP
The
[231]
--protocol
the other options would normally default to some other protocol.
On Windows, you can force a MySQL client to use a named-pipe connection by specifying the
[231]
or
pipe
--protocol=PIPE
named-pipe connections are not enabled, an error occurs. Use the
the name of the pipe if you do not want to use the default pipe name.
Connecting to the MySQL Server
on Windows or your Unix login name on Unix.
ODBC
nor
-p
--password
does not select a default database.
[231]
option and specify the password value, there must be no
[231]
--password=
[231]
option but do not specify the password value, the client
or
--password
-p
option is given to specify a port number. To ensure that the client makes
--host
option enables you to establish a particular type of connection even when
[231]
option, or by specifying
230
[231]
is given.
and the password following it.
Security".
option without any following password value:
is not interpreted as a password because it is
mydb
specially, in a way that is likely different
localhost
[231]
or
to specify a host name value
-h
--protocol=TCP
(period) as the host name. If
.
--socket
ps
auxw.
[231]
option. For example:
--
[232]
option to specify

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents