title: node js mysql Cannot Enqueue a query after calling quit
body: <p>I am using node.js and mysql, to run sql commands frequently. </p>
  
  <p>I am getting this error: <code>Cannot enqueue Handshake after invoking quit</code>.</p>
  
  <p>This is when I do </p>
  
  <pre><code>connection = mysql.createConnection(sqlDetails);
  connection.connect();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>connection.end();
  </code></pre>
  
  <p>If I comment the <code>.connect</code> and <code>.end</code> lines, then I get the error <code>ER_CON_COUNT_ERROR: Too many connections</code>.</p>
  
  <p>Does anyone know how to fix this problem?</p>
  
  <p>Thanks</p>