title: access denied while connecting to mysql through node.js
body: <p>i am trying to connect to mysql server (host : localhost) through node.js, i am really new to node.js and i have no idea on how to do this, please help!!! </p>
  
  <p>current code which i am using to connect to the server</p>
  
  <pre><code>var client = require('socket.io').listen(8080).sockets,
      mysql = require('mysql');
  
  var connection = mysql.createConnection({
      host : 'localhost',
      user : 'root',
      password : '',
      database : 'testDatabase',
      port : '3306'
  });
  connection.connect();
  var strQuery = 'select * from users';
  
  connection.query( strQuery, function(err, rows){
      if(err){
          throw err;
      }else{
          console.log(rows);
      }
  });
  connection.end();
  </code></pre>
  
  <p>which apparently gives the below error</p>
  
  <pre><code>Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'prashanthsun9'@'localhost
  ' (using password: YES)
      at Handshake.Sequence._packetToError (C:\wamp\www\node_chat\js\node_modules\
  mysql\lib\protocol\sequences\Sequence.js:30:14)
      at Handshake.ErrorPacket (C:\wamp\www\node_chat\js\node_modules\mysql\lib\pr
  otocol\sequences\Handshake.js:99:18)
      at Protocol._parsePacket (C:\wamp\www\node_chat\js\node_modules\mysql\lib\pr
  otocol\Protocol.js:205:24)
      at Parser.write (C:\wamp\www\node_chat\js\node_modules\mysql\lib\protocol\Pa
  rser.js:62:12)
      at Protocol.write (C:\wamp\www\node_chat\js\node_modules\mysql\lib\protocol\
  Protocol.js:37:16)
      at Socket.&lt;anonymous&gt; (C:\wamp\www\node_chat\js\node_modules\mysql\lib\Conne
  ction.js:73:28)
      at Socket.EventEmitter.emit (events.js:95:17)
      at Socket.&lt;anonymous&gt; (_stream_readable.js:746:14)
      at Socket.EventEmitter.emit (events.js:92:17)
      at emitReadable_ (_stream_readable.js:408:10)
      --------------------
      at Protocol._enqueue (C:\wamp\www\node_chat\js\node_modules\mysql\lib\protoc
  ol\Protocol.js:110:48)
      at Protocol.handshake (C:\wamp\www\node_chat\js\node_modules\mysql\lib\proto
  col\Protocol.js:42:41)
      at Connection.connect (C:\wamp\www\node_chat\js\node_modules\mysql\lib\Conne
  ction.js:99:18)
      at Object.&lt;anonymous&gt; (C:\wamp\www\node_chat\js\server.js:11:12)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
  </code></pre>
  
  <p>Please help, please help!!!</p>