DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Connecting

Info Catalog (mysql.info.gz) Privileges provided (mysql.info.gz) Privilege system (mysql.info.gz) Connection access
 
 5.5.4 Connecting to the MySQL Server
 ------------------------------------
 
 MySQL client programs generally expect you to specify connection
 parameters when you want to access a MySQL server:
 
    * The name of the host where the MySQL server is running
 
    * Your username
 
    * Your password
 
 For example, the `mysql' client can be started as follows from a
 command-line prompt (indicated here by `shell>'):
 
      shell> mysql -h HOST_NAME -u USER_NAME -pYOUR_PASS
 
 Alternate forms of the `-h', `-u', and `-p' options are
 `--host=HOST_NAME', `--user=USER_NAME', and `--password=YOUR_PASS'.
 Note that there is _no space_ between `-p' or `--password=' and the
 password following it.
 
 If you use a `-p' or `--password' option but do not specify the
 password value, the client program will prompt 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.  Any user on your
 system may be able to see a password specified on the command line by
 executing a command such as `ps auxww'.   Password security.
 
 MySQL client programs use default values for any connection parameter
 option that you do not specify:
 
    * The default hostname is `localhost'.
 
    * The default username is `ODBC' on Windows and your Unix login name
      on Unix.
 
    * No password is supplied if `-p' is missing.
 
 Thus, for a Unix user with a login name of `joe', all of the following
 commands are equivalent:
 
      shell> mysql -h localhost -u joe
      shell> mysql -h localhost
      shell> mysql -u joe
      shell> mysql
 
 Other MySQL clients behave similarly.
 
 You can specify different default values to be used when you make a
 connection so that you need not enter them on the command line each
 time you invoke a client program.  This can be done in a couple of ways:
 
    * You can specify connection parameters in the `[client]' section of
      an option file.  The relevant section of the file might look like
      this:
 
           [client]
           host=HOST_NAME
           user=USER_NAME
           password=YOUR_PASS
 
      Option files are discussed further in  Option files.
 
    * You can specify some connection parameters using environment
      variables.  The host can be specified for `mysql' using
      `MYSQL_HOST'.  The MySQL username can be specified using `USER'
      (this is for Windows and NetWare only).  The password can be
DONTPRINTYET       specified using `MYSQL_PWD', although this is insecure; see 
      Password security.  For a list of variables, see *Note
DONTPRINTYET       specified using `MYSQL_PWD', although this is insecure; see 
      Password security.  For a list of variables, see 

      Environment variables.
 
Info Catalog (mysql.info.gz) Privileges provided (mysql.info.gz) Privilege system (mysql.info.gz) Connection access
automatically generated byinfo2html