dimanche 12 juin 2016

Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433

I'm trying to connect to my local MySql server from node.js/express application using mssql with following config:

// Database connection
var sql = require('mssql');
var config = {
    user: 'db_user',
    password: 'db_pass',
    server: 'localhost',
    database: 'project_db'
};
sql.connect(config, function (err) {
    if (err) {
        console.log(err);
    }
});

I get this error:

{ [ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433]
  name: 'ConnectionError',
  message: 'Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433',
  code: 'ESOCKET' }

I know I have to enable TCP/IP connections for my local MySql server, but I can not find how to do it on OSX El Capitan. There is nothing like control panel with settings. That's all available at System Preferences > MySql: enter image description here Any ideas how to fix this, guys? Thanks for trying to help.

Aucun commentaire:

Enregistrer un commentaire