title: Unable to connect to MSSQL server through Node, while Intellij connection works (MacOS)
body: <p>I'm running into a strange behaviour where I'm unable to connect to an instance of MSSQL server running locally on docker when using a Node js script, but I can connect to it using Intellij's built-in JDBC connector.</p>
  
  <p>This is the script:</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>import mysql from "mysql"
  
  const connection = mysql.createConnection({
      host     : 'localhost',
      user     : 'sa',
      password : 'P@55w0rd!',
      database : 'ml_project',
      port: 1433,
      connectionLimit: 15,
      queueLimit: 30,
      acquireTimeout: 1000000
  });
  
  connection.connect(function(err) {
      if ( !err ) {
          console.log("Connected to MySQL");
      } else if ( err ) {
          console.log(err);
      }
  });
  
  connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
      if (error) throw error;
      console.log(results[0].solution);
      connection.end();
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Which outputs the following error:</p>
  
  <pre><code>Error: Connection lost: The server closed the connection.
      at Protocol.end (/Users/IoannouK/ml_project/node_modules/mysql/lib/protocol/Protocol.js:112:13)
      at Socket.&lt;anonymous&gt; (/Users/IoannouK/ml_project/node_modules/mysql/lib/Connection.js:94:28)
      at Socket.&lt;anonymous&gt; (/Users/IoannouK/ml_project/node_modules/mysql/lib/Connection.js:526:10)
      at Socket.emit (events.js:322:22)
      at endReadableNT (_stream_readable.js:1187:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
      --------------------
      at Protocol._enqueue (/Users/IoannouK/ml_project/node_modules/mysql/lib/protocol/Protocol.js:144:48)
      at Protocol.handshake (/Users/IoannouK/ml_project/node_modules/mysql/lib/protocol/Protocol.js:51:23)
      at Connection.connect (/Users/IoannouK/ml_project/node_modules/mysql/lib/Connection.js:116:18)
      at Object.&lt;anonymous&gt; (/Users/IoannouK/ml_project/dist/mysql.js:17:12)
      at Module._compile (internal/modules/cjs/loader.js:1156:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
      at Module.load (internal/modules/cjs/loader.js:1000:32)
      at Function.Module._load (internal/modules/cjs/loader.js:899:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
      at internal/main/run_main_module.js:18:47 {
    fatal: true,
    code: 'PROTOCOL_CONNECTION_LOST'
  }
  /Users/IoannouK/ml_project/dist/mysql.js:27
          throw error;
          ^
  </code></pre>
  
  <p>And this is the settings panel in my Intellij which works:</p>
  
  <p><a href="https://i.stack.imgur.com/FiuYJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FiuYJ.png" alt="enter image description here"></a></p>
  
  <p>I have also tried connecting to a remote database, as well as using a python script, but I received the same results.</p>