title: Trouble making nodejs mysql connection
body: <p>I am trying to make a simple connection between my nodejs server and my mysql db (using Microsoft SQL server manager studio v14), below is my code and the error message appearing in my console window.</p>
  
  <p>here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var express = require('express');
  var app = express();
  var sql = require("mssql");
  
  app.get('/', function (req, res) {
     
      // config for your database
      var config = {
          user: 'superadmin',
          password: '***',
          server: 'localhost', 
          database: 'XXX' 
      };
  
      // connect to your database
      sql.connect(config, function (err) {
      
          if (err) console.log(err);
  
          // create Request object
          var request = new sql.Request();
             
          // query to the database and get the records
          request.query('select * from Schools', function (err, recordset) {
              
              if (err) console.log(err)
  
              // send records as a response
              res.send(recordset);
              
          });
      });
  });
  
  var server = app.listen(5000, function () {
      console.log('Server is running..');
  });
   </code></pre>
  </div>
  </div>
  </p>
  
  <p>The error I am getting looks like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Server is running..
  tedious deprecated The default value for `options.encrypt` will change from `false` to `true`. Please pass `false` explicitly if you want to retain current behaviour. node_modules\mssql\lib\tedious.js:212:23
  { ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
      at Connection.tedious.once.err (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\mssql\lib\tedious.js:216:17)
      at Object.onceWrapper (events.js:275:13)
      at Connection.emit (events.js:182:13)
      at Connection.socketError (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connection.js:1004:14)
      at C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connection.js:869:25
      at SequentialConnectionStrategy.connect (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connector.js:154:9)
      at Socket.onError (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connector.js:170:16)
      at Socket.emit (events.js:182:13)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    code: 'ESOCKET',
    originalError:
     { ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
      at ConnectionError (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\errors.js:12:12)
      at Connection.socketError (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connection.js:1004:30)
      at C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connection.js:869:25
      at SequentialConnectionStrategy.connect (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connector.js:154:9)
      at Socket.onError (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\tedious\lib\connector.js:170:16)
      at Socket.emit (events.js:182:13)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
      at process._tickCallback (internal/process/next_tick.js:174:19)
       message: 'Failed to connect to localhost:1433 - Could not connect (sequence)',
       code: 'ESOCKET' },
    name: 'ConnectionError' }
  { ConnectionError: Connection is closed.
      at Request._query (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\mssql\lib\base.js:1299:37)
      at Request._query (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\mssql\lib\tedious.js:497:11)
      at Request.query (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\mssql\lib\base.js:1242:12)
      at C:\Users\smr09\Desktop\Code\ou\db_test\test.js:24:17
      at _poolCreate.then.catch.err (C:\Users\smr09\Desktop\Code\ou\db_test\node_modules\mssql\lib\base.js:269:7)
      at process._tickCallback (internal/process/next_tick.js:178:7) code: 'ECONNCLOSED', name: 'ConnectionError' }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am rather new at this particularly with dealing with databases. Can someone explain what the error means?</p>