Databases Reference
In-Depth Information
host
The host the server is running on; you can leave this out if the server is running on
the same host as the client ( localhost ).
user
The username to use when connecting to the MySQL server. This bears no relation
to the username the server is running under, or to your Linux or Mac OS X user-
name. If you don't provide a username with this option, the monitor uses a default
value; this default username is your machine account name on a Linux or Mac OS
X system, and ODBC on a Windows system.
password
The password of this user. If you don't provide the password parameter, no pass-
word is supplied to the server. This is fine if there is no password stored for that
user, but if the user does have a password, the connection will fail:
$ mysql --user= the_username
ERROR 1045 (28000): Access denied for user ' the_username '@'localhost'
(using password: NO)
If you include the password option but don't specify a password, the client will
prompt you for a password after you press the Enter key. If the user has no pass-
word, pressing the Enter key will work; otherwise, the connection will fail again:
$ mysql --user= the_username --password
Enter password:
ERROR 1045 (28000): Access denied for user ' the_username '@'localhost'
(using password: NO)
If you provide an incorrect password, or you don't have permission to access a
specified database, MySQL will note this in the error message:
$ mysql --user= the_username --password= wrong_password
Enter password:
ERROR 1045 (28000): Access denied for user ' the_username '@'localhost'
(using password: YES)
If you specify the correct password at the Enter password: prompt, or if you specify
the correct password on the command line when starting the monitor, the con-
nection will succeed:
$ mysql --user= the_username --password= the_password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 169 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Some users prefer not to specify the password on the command line because sup-
pressing the password guarantees the password won't be displayed in the operating
system process table or command history. Under all operating systems we've tes-
ted, the password is hidden and can't be seen using operating system utilities to
 
Search WWH ::




Custom Search