Friday, December 2, 2016

Error: connect ECONNREFUSED

In macOS environment there is no explicit file for my.cnf. It's weird, before I introduced .my.cnf in home directory, applications can connect to remote host (e.g., just fine.

The solution is to force the TCP on .my.cnf


$ brew services restart mysql

It turns out that the MySQL installation on my machine is using socket. What's odd is I'm not using localhost (e.g., for database connection's host despite server and client are same machine, yet MySQL still resorts to using socket.

On Unix, if you are running the server and the client on the same machine, connect to localhost. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file, unless there are connection parameters specified to ensure that the client makes a TCP/IP connection

No comments:

Post a Comment