title: Connecting to MySQL through SSH tunnel to vagrant from Cypress
body: <p>So i have this piece of code working:</p>
  <pre class="lang-js prettyprint-override"><code>const mysqlSsh = require('mysql-ssh')
  
  const localDbClinics = {
      host: 'localhost',
      port: 3306,
      user: '****',
      password: '****',
      database: '********'
  }
  const localDbSsh = {
      host: 'localhost',
      port: 2222,
      username: 'vagrant',
      privateKey: require('fs').readFileSync('path/to/vagrant/generated/private_key')
  }
  
  mysqlSsh.connect(localDbSsh, localDbClinics).then(client =&gt; {
      client.query(`SELECT COUNT(*) as &quot;rowCount&quot; FROM notification;`, (err, results, fields) =&gt; {
          if (err) throw err;
          console.log(results[0].rowCount)
          mysqlSsh.close();
      })
  }).catch(console.error)
  </code></pre>
  <p>But when I add this code as a Cypress task in <code>cypress/plugins/index.js</code> and use it in a &quot;proof of concept&quot; test case, Cypress UI gives me following error:</p>
  <p><strong>Title:</strong> Error running plugin</p>
  <p><strong>Message:</strong> The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (<code>/home/radar/WebstormProjects/testing/cypress/plugins/index.js</code>)</p>
  <p><strong>Details:</strong> Error: All configured authentication methods failed
  at tryNextAuth (/home/radar/WebstormProjects/testing/node_modules/ssh2/lib/client.js:380:17)
  at SSH2Stream.onUSERAUTH_FAILURE (/home/radar/WebstormProjects/testing/node_modules/ssh2/lib/client.js:591:5)
  at SSH2Stream.emit (events.js:315:20)
  at parsePacket (/home/radar/WebstormProjects/testing/node_modules/ssh2-streams/lib/ssh.js:3929:10)
  at SSH2Stream._transform (/home/radar/WebstormProjects/testing/node_modules/ssh2-streams/lib/ssh.js:669:13)
  at SSH2Stream.Transform._read (_stream_transform.js:191:10)
  at SSH2Stream._read (/home/radar/WebstormProjects/testing/node_modules/ssh2-streams/lib/ssh.js:251:15)
  at SSH2Stream.Transform._write (_stream_transform.js:179:12)
  at doWrite (_stream_writable.js:403:12)
  at writeOrBuffer (_stream_writable.js:387:5)
  at SSH2Stream.Writable.write (_stream_writable.js:318:11)
  at Socket.ondata (_stream_readable.js:716:22)
  at Socket.emit (events.js:315:20)
  at addChunk (_stream_readable.js:295:12)
  at readableAddChunk (_stream_readable.js:271:9)
  at Socket.Readable.push (_stream_readable.js:212:10)</p>
  <p><strong>Stack trace:</strong></p>
  <pre><code>Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`/home/radar/WebstormProjects/testing/cypress/plugins/index.js`)
      at Object.get (/home/radar/.cache/Cypress/6.6.0/Cypress/resources/app/packages/server/lib/errors.js:966:15)
      at EventEmitter.handleError (/home/radar/.cache/Cypress/6.6.0/Cypress/resources/app/packages/server/lib/plugins/index.js:168:20)
      at EventEmitter.emit (events.js:315:20)
      at ChildProcess.&lt;anonymous&gt; (/home/radar/.cache/Cypress/6.6.0/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
      at ChildProcess.emit (events.js:315:20)
      at emit (internal/child_process.js:876:12)
      at processTicksAndRejections (internal/process/task_queues.js:85:21)
  </code></pre>
  <p>Is connecting to a database like this even possible from Cypress?</p>