node.js mysql error: ECONNREFUSED

I know this question has been answered, but for me the problem was that the mysql server listens on a Unix socket not on a tcp socket. So the solution was to add:

port: '/var/run/mysqld/mysqld.sock'

to the connection options.

Leave a Comment