Create Unix Named Socket from the Command Line

There is no exact equivalent of mkfifo for socket, i.e. there is no command that just creates a “hanging” socket. This is for historical reason: server’s function bind(), the one that creates a socket name/inode in the filesystem, fails if the name is already used. In other words, server cannot operate on a pre-existing socket. … Read more

Unix socket vs TCP/IP host:port

Unix sockets are a little bit faster as you don’t have the tcp-overhead. If you realize this performance loss is a question of server load. If you don’t have very high server load you won’t recognize it. If you use Jails (FreeBSD) or some other virtualisation technology to separate the e.g. MySQL-Server from the Webserver, … Read more

How to force MySQL to connect by TCP instead of a Unix socket?

In Linux and other *nixes, MySQL will assume you want to use a socket if you connect to the host “localhost” (which would be the default hostname). You can override this in 3 ways: 1) Specify a different hostname like 127.0.0.1 (mysql -h 127.0.0.1) or your server’s real hostname 2) Specify that you want to … Read more

What is the difference between Unix sockets and TCP/IP sockets?

A UNIX socket, AKA Unix Domain Socket, is an inter-process communication mechanism that allows bidirectional data exchange between processes running on the same machine. IP sockets (especially TCP/IP sockets) are a mechanism allowing communication between processes over the network. In some cases, you can use TCP/IP sockets to talk with processes running on the same … Read more