<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="transport-protocols">
      </a>
      6.2.7 Connection Transport Protocols
     </h3>
    </div>
   </div>
  </div>
  <p>
   For programs that use the MySQL client library (for example,
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   and
   <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
    <span class="command">
     <strong>
      mysqldump
     </strong>
    </span>
   </a>
   ), MySQL
      supports connections to the server based on several transport
      protocols: TCP/IP, Unix socket file, named pipe, and shared
      memory. This section describes how to select these protocols, and
      how they are similar and different.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="transport-protocols.html#transport-protocol-selection" title="Transport Protocol Selection">
       Transport Protocol Selection
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="transport-protocols.html#transport-protocol-local-remote" title="Transport Support for Local and Remote Connections">
       Transport Support for Local and Remote Connections
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="transport-protocols.html#transport-protocol-localhost" title="Interpretation of localhost">
       Interpretation of localhost
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="transport-protocols.html#transport-protocol-encryption" title="Encryption and Security Characteristics">
       Encryption and Security Characteristics
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="transport-protocols.html#transport-protocol-compression" title="Connection Compression">
       Connection Compression
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="transport-protocol-selection">
       </a>
       Transport Protocol Selection
      </h4>
     </div>
    </div>
   </div>
   <p>
    For a given connection, if the transport protocol is not
        specified explicitly, it is determined implicitly. For example,
        connections to
    <code class="literal">
     localhost
    </code>
    result in a socket
        file connection on Unix and Unix-like systems, and a TCP/IP
        connection to
    <code class="literal">
     127.0.0.1
    </code>
    otherwise. For
        additional information, see
    <a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
     Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
    </a>
    .
   </p>
   <p>
    To specify the protocol explicitly, use the
    <a class="link" href="connection-options.html#option_general_protocol">
     <code class="option">
      --protocol
     </code>
    </a>
    command option. The
        following table shows the permissible values for
    <a class="link" href="connection-options.html#option_general_protocol">
     <code class="option">
      --protocol
     </code>
    </a>
    and indicates the
        applicable platforms for each value. The values are not
        case-sensitive.
   </p>
   <div class="informaltable">
    <table summary="Permissible transport protocol values, the resulting transport protocol used, and the applicable platforms for each value.">
     <colgroup>
      <col style="width: 20%"/>
      <col style="width: 50%"/>
      <col style="width: 30%"/>
     </colgroup>
     <thead>
      <tr>
       <th scope="col">
        <a class="link" href="connection-options.html#option_general_protocol">
         <code class="option">
          --protocol
         </code>
        </a>
        Value
       </th>
       <th scope="col">
        Transport Protocol Used
       </th>
       <th scope="col">
        Applicable Platforms
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <th scope="row">
        <code class="literal">
         TCP
        </code>
       </th>
       <td>
        TCP/IP
       </td>
       <td>
        All
       </td>
      </tr>
      <tr>
       <th scope="row">
        <code class="literal">
         SOCKET
        </code>
       </th>
       <td>
        Unix socket file
       </td>
       <td>
        Unix and Unix-like systems
       </td>
      </tr>
      <tr>
       <th scope="row">
        <code class="literal">
         PIPE
        </code>
       </th>
       <td>
        Named pipe
       </td>
       <td>
        Windows
       </td>
      </tr>
      <tr>
       <th scope="row">
        <code class="literal">
         MEMORY
        </code>
       </th>
       <td>
        Shared memory
       </td>
       <td>
        Windows
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="transport-protocol-local-remote">
       </a>
       Transport Support for Local and Remote Connections
      </h4>
     </div>
    </div>
   </div>
   <p>
    TCP/IP transport supports connections to local or remote MySQL
        servers.
   </p>
   <p>
    Socket-file, named-pipe, and shared-memory transports support
        connections only to local MySQL servers. (Named-pipe transport
        does allow for remote connections, but this capability is not
        implemented in MySQL.)
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="transport-protocol-localhost">
       </a>
       Interpretation of localhost
      </h4>
     </div>
    </div>
   </div>
   <p>
    If the transport protocol is not specified explicitly,
    <code class="literal">
     localhost
    </code>
    is interpreted as follows:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       On Unix and Unix-like systems, a connection to
       <code class="literal">
        localhost
       </code>
       results in a socket-file
            connection.
      </p>
     </li>
     <li class="listitem">
      <p>
       Otherwise, a connection to
       <code class="literal">
        localhost
       </code>
       results in a TCP/IP connection to
       <code class="literal">
        127.0.0.1
       </code>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    If the transport protocol is specified explicitly,
    <code class="literal">
     localhost
    </code>
    is interpreted with respect to that
        protocol. For example, with
    <a class="link" href="connection-options.html#option_general_protocol">
     <code class="option">
      --protocol=TCP
     </code>
    </a>
    , a connection to
    <code class="literal">
     localhost
    </code>
    results in a TCP/IP connection to
    <code class="literal">
     127.0.0.1
    </code>
    on all platforms.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="transport-protocol-encryption">
       </a>
       Encryption and Security Characteristics
      </h4>
     </div>
    </div>
   </div>
   <p>
    TCP/IP and socket-file transports are subject to TLS/SSL
        encryption, using the options described in
    <a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
     Command Options for Encrypted Connections
    </a>
    . Named-pipe and
        shared-memory transports are not subject to TLS/SSL encryption.
   </p>
   <p>
    A connection is secure by default if made over a transport
        protocol that is secure by default. Otherwise, for protocols
        that are subject to TLS/SSL encryption, a connection may be made
        secure using encryption:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       TCP/IP connections are not secure by default, but can be
            encrypted to make them secure.
      </p>
     </li>
     <li class="listitem">
      <p>
       Socket-file connections are secure by default. They can also
            be encrypted, but encrypting a socket-file connection makes
            it no more secure and increases CPU load.
      </p>
     </li>
     <li class="listitem">
      <p>
       Named-pipe connections are not secure by default, and are
            not subject to encryption to make them secure. However, the
       <a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
        <code class="literal">
         named_pipe_full_access_group
        </code>
       </a>
       system variable is available to control which MySQL users
            are permitted to use named-pipe connections.
      </p>
     </li>
     <li class="listitem">
      <p>
       Shared-memory connections are secure by default.
      </p>
     </li>
    </ul>
   </div>
   <p>
    If the
    <a class="link" href="server-system-variables.html#sysvar_require_secure_transport">
     <code class="literal">
      require_secure_transport
     </code>
    </a>
    system variable is enabled, the server permits only connections
        that use some form of secure transport. Per the preceding
        remarks, connections that use TCP/IP encrypted using TLS/SSL, a
        socket file, or shared memory are secure connections. TCP/IP
        connections not encrypted using TLS/SSL and named-pipe
        connections are not secure.
   </p>
   <p>
    See also
    <a class="xref" href="using-encrypted-connections.html#mandatory-encrypted-connections" title="Configuring Encrypted Connections as Mandatory">
     Configuring Encrypted Connections as Mandatory
    </a>
    .
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="transport-protocol-compression">
       </a>
       Connection Compression
      </h4>
     </div>
    </div>
   </div>
   <p>
    All transport protocols are subject to use of compression on the
        traffic between the client and server. If both compression and
        encryption are used for a given connection, compression occurs
        before encryption. For more information, see
    <a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
     Section 6.2.8, “Connection Compression Control”
    </a>
    .
   </p>
  </div>
 </div>
 <br/>
</div>
