How can I explicitly tell the MySQL client to use TCP/IP instead of the socket file to connect locally?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I explicitly tell the MySQL client to use TCP/IP instead of the socket file to connect locally?
Asked by:
103 Viewed 103 Answers
Responsive Ad After Question

Answer (103)

Best Answer
(288)
You can force the MySQL client to use TCP/IP for local connections by specifying the host as `127.0.0.1` or `localhost` and using the `--port` option if it's not the default (3306). For example: `mysql -u your_user -p --host=127.0.0.1 --port=3306`. This bypasses the socket file entirely.