DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) multiple-server-clients

Info Catalog (mysql.info) multiple-unix-servers (mysql.info) multiple-servers
 
 5.13.3 Using Client Programs in a Multiple-Server Environment
 -------------------------------------------------------------
 
 To connect with a client program to a MySQL server that is listening to
 different network interfaces from those compiled into your client, you
 can use one of the following methods:
 
    * Start the client with -host=HOST_NAME -port=PORT_NUMBER to connect
      via TCP/IP to a remote server, with -host=127.0.0.1
      -port=PORT_NUMBER to connect via TCP/IP to a local server, or with
      -host=localhost -socket=FILE_NAME to connect to a local server via
      a Unix socket file or a Windows named pipe.
 
    * As of MySQL 4.1, start the client with -protocol=tcp to connect
      via TCP/IP, -protocol=socket to connect via a Unix socket file,
      -protocol=pipe to connect via a named pipe, or -protocol=memory to
      connect via shared memory. For TCP/IP connections, you may also
      need to specify -host and -port options. For the other types of
      connections, you may need to specify a -socket option to specify a
      Unix socket file or Windows named-pipe name, or a
      -shared-memory-base-name option to specify the shared-memory name.
      Shared-memory connections are supported only on Windows.
 
    * On Unix, set the `MYSQL_UNIX_PORT' and `MYSQL_TCP_PORT'
      environment variables to point to the Unix socket file and TCP/IP
      port number before you start your clients. If you normally use a
      specific socket file or port number, you can place commands to set
      these environment variables in your `.login' file so that they
      apply each time you log in. See  environment-variables.
 
    * Specify the default Unix socket file and TCP/IP port number in the
      `[client]' group of an option file.  For example, you can use
      `C:\my.cnf' on Windows, or the `.my.cnf' file in your home
      directory on Unix. See  option-files.
 
    * In a C program, you can specify the socket file or port number
      arguments in the `mysql_real_connect()' call. You can also have
      the program read option files by calling `mysql_options()'. See
       c-api-functions.
 
    * If you are using the Perl `DBD::mysql' module, you can read
      options from MySQL option files. For example:
 
           $dsn = "DBI:mysql:test;mysql_read_default_group=client;"
                   . "mysql_read_default_file=/usr/local/mysql/data/my.cnf";
           $dbh = DBI->connect($dsn, $user, $password);
 
      See  perl.
 
      Other programming interfaces may provide similar capabilities for
      reading option files.
 
Info Catalog (mysql.info) multiple-unix-servers (mysql.info) multiple-servers
automatically generated byinfo2html