title: how to connect Node.js with MySQL 8.0 using Express?
body: <p>I am trying to connect Nodejs with MySQL 8.0  using Express.
  my code: </p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var mysql = require('mysql');
  
  router.get('/', function(req, res, next) { 
      var connection = mysql.createConnection({
        host     : 'localhost',
        user     : 'root',
        password : 'rootpass'
      });    
      connection.connect(function(err) {
        if (err) throw err;
        console.log('Connected!');
      });
  });
  </code></pre>
  
  <p>the above code is in the official Express page, but i suppose it is for MySQL versions under 8.0.</p>
  
  <p>when i run the project i get the next error:</p>
  
  <pre><code> throw err; // Rethrow non-MySQL errors
      ^
  Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
  at Handshake.Sequence._packetToError (G:\Fractal projets\fractalpage\bfweb\node_modules\mysql\lib\protocol\sequences\Sequence.js:52:14)
  </code></pre>
  
  <p>MySQL was previously installed</p>