title: Node.js process cannot recover after MySQL turned off, then turn on
body: <p>I am using Node.js with MySQL and restify.</p>
  
  <p>I have the following code which is run as part of a REST API. It works fine.</p>
  
  <pre><code>server.get('/test', function (req, res, next) {
      var query_string =
          "SELECT DATE(date_transacted) AS transaction_date, " +
          " MonthReports.tb AS MonthReports__tb " +
          " FROM monthly_reports MonthReports " +
          " WHERE ( date_transacted &gt;= \'2015-01-00\' AND date_transacted &lt;= \'2015-09-00\' ) ";
  
      connection.query(
          query_string
          , function (err, rows, fields) {
              if (err) throw err;
              res.send(rows);
          });
  });
  </code></pre>
  
  <p>If I deliberately turn off the MySQL database and makes a REST API call which will run the query, I will get the error </p>
  
  <blockquote>
    <p>Cannot enqueue Query after fatal error.</p>
  </blockquote>
  
  <p>At this point, I turn on the MySQL database. The node.js process is unable to recover and the same error keeps appearing when I make a REST API call. The REST API server is dead.</p>
  
  <p>What can be done to make the Node.js REST API server code recoverable?</p>