title: The server closed the connection
body: <p>I'm trying to Node.js and MySql but im receiving this error :</p>
  
  <blockquote>
    <p>:Error: Connection lost: The server closed the connection. my code here.</p>
  </blockquote>
  
  <pre><code>var mysql = require('mysql');
  var config = {
      connectionLimit: 100,
      waitForConnections: true,
      queueLimit: 0,
      debug: true,
      wait_timeout: 28800,
      connect_timeout: 10,
      host: "localhost",
      user: " root ",
      password: " root ",
      database: "mydb"
  };
  var table = 'mytable';
  var connection;
  
  function handleConnection() {
      connection = mysql.createConnection(config);
      connection.connect(function(err) {
          console.log("connected");
      });
      connection.query('select * from' + table,
          function(err, result, fields) {
              if (!err) {
                  console.log("result :" + result);
              } else {
                  console.log("error1 :" + err);
              }
          });
  }
  </code></pre>