Using Client Programs in a Multiple-Server Environment With the information displayed by that command, you can tell what option values  not  to use when configuring an additional server. If you specify  localhost  as the host name,  mysqladmin  defaults to using a Unix socket file rather than TCP/IP. To explicitly specify the transport protocol, use the  --protocol={TCP|SOCKET|PIPE|MEMORY} option. You need not compile a new MySQL server just to start with a different Unix socket file and TCP/IP port number. It is also possible to use the same server binary and start each invocation of it with different parameter values at runtime. One way to do so is by using command-line options: To start a second server, provide different  --socket  and  --port  option values, and pass a  -- datadir= dir_name  option to  mysqld_safe  so that the server uses a different data directory. Alternatively, put the options for each server in a different option file, then start each server using a  -- defaults-file  option that specifies the path to the appropriate option file. For example, if the option files for two server instances are named  /usr/local/mysql/my.cnf  and  /usr/local/mysql/my.cnf2 , start the servers like this: command: Another way to achieve a similar effect is to use environment variables to set the Unix socket file name and TCP/IP port number: This is a quick way of starting a second server to use for testing. The nice thing about this method is that the environment variable settings apply to any client programs that you invoke from the same shell. Thus, connections for those clients are automatically directed to the second server. Section 4.9, “Environment Variables” , includes a list of other environment variables you can use to affect MySQL programs. On Unix, the  mysqld_multi  script provides another way to start multiple servers. See Section 4.3.4, “mysqld_multi — Manage Multiple MySQL Servers” . 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  --protocol=TCP  to connect using TCP/IP,  --protocol=SOCKET  to connect using a Unix socket file,  --protocol=PIPE  to connect using a named pipe, or  --protocol=MEMORY to connect using 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. •Start the client with  --host= host_name --port= port_number  to connect using TCP/IP to a remote server, with  --host=127.0.0.1 --port= port_number  to connect using TCP/IP to a local server, or with  --host=localhost --socket= file_name  to connect to a local server using a Unix socket file or a Windows named pipe. 5.8.4 Using Client Programs in a Multiple-Server Environment shell>  MYSQL_UNIX_PORT=/tmp/mysqld-new.sock shell>  MYSQL_TCP_PORT=3307 shell>  export MYSQL_UNIX_PORT MYSQL_TCP_PORT shell>  bin/mysqld --initialize --user=mysql shell>  mysqld_safe --datadir=/path/to/datadir & shell>  mysqld_safe --defaults-file=/usr/local/mysql/my.cnf shell>  mysqld_safe --defaults-file=/usr/local/mysql/my.cnf2 shell>  mysqld_safe --socket= file_name  --port= port_number 1152