MySQL connect by TCP instead of a Unix socket

To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection protocol explicitly, even for localhost, by using the --protocol=TCP option. Examples:


mysql --host=127.0.0.1
mysql --protocol=TCP

You can also easily make that the default my editing your my.cnf so it has this ([client] means any client:

[client]
protocol=tcp

Comments