title: NodeJS + MySQL connects from localhost, but not heroku
body: <p>I've got a simple web app that needs to connect to my database. I created a user called public which can only SELECT from the database.</p>
  
  <p>Everything works perfectly fine from localhost. I deployed the app on Heroku, and it gives me the following error:</p>
  
  <blockquote>
    <p>2016-10-18T00:17:59.282323+00:00 app[web.1]: Couldn't connect :(  Error: connect ETIMEDOUT
    2016-10-18T00:17:59.282562+00:00 app[web.1]: Something went wrong... Error: connect ETIMEDOUT</p>
  </blockquote>
  
  <pre><code>app.get("/", function(request, response){
      response.render("index");
  });
  
  // request for quotes is received
  app.get("/get", function(req, res){
  
      // open a connection to the database
      var connection = mysql.createConnection({
          connectionLimit: 100,
          host: "my-test-database.c3j6vph7cyv2.us-west-2.rds.amazonaws.com",
          user: "public",
          password:"helloworld",
          database:"quotes"
      });
  
      // connect to the database
      connection.connect(function(error){
          if(error){
              console.log("Couldn't connect :(  " + error);
          } else {
              console.log("Connected successfully~!");
          }    
      });
  
      // retrieve quotes from database
      connection.query("SELECT * FROM Quotes", function(error, rows, fields){
         if (error) {
             console.log("Something went wrong... " + error);
             res.end();
         } else {
            res.jsonp({"quotes": rows});
         }
      });
  
      connection.end();
  });
  </code></pre>