title: Access denied for user ''@'localhost' (using password: NO) when trying to connect to phpmyadmin mysql database
body: <p>I'm using the mysql module in my node.js code to connect to my xampp's mysql database like so:</p>
  <pre><code>let mysql = require('mysql');
  
  let db = mysql.createConnection({
      host: 'localhost',
      database: 'quiz_database',
      user: 'root',
      password: ''
  })
  
  db.connect(function (error) {
      if (error) console.log(error);
      else console.log(&quot;MYSQL Connected...&quot;);
  })
  
  module.exports = db;
  </code></pre>
  <p>but when I run it, I get</p>
  <pre><code>  code: 'ER_ACCESS_DENIED_ERROR',
    errno: 1045,
    sqlMessage: &quot;Access denied for user ''@'localhost' (using password: NO)&quot;,
    sqlState: '28000',
    fatal: true
  </code></pre>
  <p>I checked out some solutions online and it led me to changing my password in the shell using</p>
  <blockquote>
  <p>mysql -u root password</p>
  </blockquote>
  <p>and I changed the password in the config.inc.php, but the problem still persists.
  What do I do?</p>