Programs such as mysql and mysqldump using the MySQL client library support connecting MySQL to server files and naming through multiple transmission protocols (such as TCP/IP, Unix sockets) Pipes, shared memory, etc.
For a given connection, if no transport protocol is specified, it is identified as a separate task.
A connection to localhost will result in a socket file connection on Unix and Unix-like systems, otherwise a TCP/IP connection to 127.0.0.1. If a protocol must be specified specifically, this can be done using the --protocol command option.
The following table shows the allowed values for --protocol and tells the platform where each value applies. Note that these values are not case-sensitive.
--Protocol value | Transmission protocol used | Applicable platform |
---|---|---|
TCP | TCP/IP | All |
SOCKET | Unix Socket File | Unix and Unix-like systems |
Named Pipes | Windows | Shared Memory | Windows |
The above is the detailed content of How to force MySQL to connect via TCP instead of Unix socket?. For more information, please follow other related articles on the PHP Chinese website!