title: Node JS and mysql not connecting (client does not support authentication protocol requested by server consider upgrading mysql client)
body: <p>I'm trying to connect my NodeJs application with a mysql database but its not connecting for some reason.</p>
  <p>I did install the mysql npm like this (typed this in commandline):</p>
  <pre><code>npm install mysql
  </code></pre>
  <p>After I installed the mysql npm I made an index.js file and in that file I tried to make the connection with my database.</p>
  <p>This is the code inside my index.js file to make a connection with mysql:</p>
  <pre><code>const mysql      = require('mysql');
  
  var connection = mysql.createConnection({
      host     : 'localhost',
      user     : 'root',
      port     : '3306',
      password : 'test12310',
      database : 'fys'
  });
  
  
  connection.connect((err) =&gt; {
      if(!err)
          console.log('Database is geconnect!');
      else
          console.log('Database connectie niet gelukt!  : '+ JSON.stringify(err, undefined,2));
  });
  </code></pre>
  <p>Then I tried to run the code and see if the connection with mysql worked. I typed this in the command line:</p>
  <pre><code>node index.js
  </code></pre>
  <p>This is the error message I got in the command prompt :</p>
  <p><a href="https://i.stack.imgur.com/dl06g.png" rel="nofollow noreferrer">error image</a></p>
  <p>Does anyone know how I can fix this error and get a connection with my mysqldatabase in nodejs ?</p>
  <p>Any kind of help is appreciated</p>