tags:

views:

43

answers:

1

Hi guys, when I am using 'localhost' as the host for MySQL database, sequel pro alert me that I will be using socket. On the other hand, if I use '127.0.0.1', i would be using the ip address and port 3306 to reach the server.

What is the difference?

+2  A: 

A Unix socket is a data communications endpoint that is similar to an network socket, but does not use a network protocol for communication. These are used in POSIX operating systems for inter-process communication. (Source)

The "localhost -> socket" rule appears to be hardcoded in the MySQL client library, according to a forum post by a MySQL developer. (Source)

Daniel Vassallo
Yeah, it's quicker to transfer over a socket than a TCP port because it avoids the overhead of the network stack. I think PostgreSQL does the same thing.
Andy Shellam
Careful with the terminology - a TCP port is part of a socket. (In fact, a port isn't a 'thing' at all, just a number associated with a socket.) It just happens to be a different type of socket...
Kylotan