We use the MySQL C connection API – mysql_real_connect() to connect to MySQL.
According to the MySQL documentation
Quote:
If host is NULL or the string “localhost”, a connection to the local host is assumed. For Windows, the client connects using a shared-memory connection, if the server has shared-memory connections enabled. Otherwise, TCP/IP is used.
So, this API automatically detects the connection protocol (using the rules above) and connects using it. Therefore you should not specify “localhost” if you are using shared memory.
We will also look into this and see if there is anyway we can force a specific type of connection, but for now you should specify the IP address rather than “localhost”.