title: Amazon RDS Unknown MYSQL Host
body: <p>I've been trying to connect to an RDS database from an application I'm hosting on elastic beanstalk.  It gives me this error:</p>
  
  <pre><code>[Instance: i-0f0051f7599e17190] Command failed on instance. Return code: 1 
  Output: (TRUNCATED)... -s /bin/bash -c 'leader_only bundle exec rake 
  db:migrate' webapp rake aborted! Mysql2::Error: Unknown MySQL server host 
  'xxxxxxxxxx.xxxxxxxxx.us-west-2.rds.amazonaws.com' (25) Tasks: TOP =&gt; 
   db:migrate (See full trace by running task with --trace). Hook 
  /opt/elasticbeanstalk/hooks/appdeploy/pre/12_db_migration.sh failed. For 
  more detail, check /var/log/eb-activity.log using console or EB CLI.
  </code></pre>
  
  <p>The server host is the correct hostname of the database, I just x'd it out.<br>
  I am able to connect to and view this database via the MYSQL workbench but not on localhost or AWS.  I've tried putting the host in manually rather than using a variable but that gave me the same error</p>
  
  <p>Here is where I try to connect in my database.yml file</p>
  
  <pre><code>production:
    adapter: mysql2
    encoding: utf8
    database: &lt;%= ENV['RDS_DB_NAME'] %&gt;
    username: &lt;%= ENV['RDS_USERNAME'] %&gt;
    password: &lt;%= ENV['RDS_PASSWORD'] %&gt;
    host: &lt;%= ENV['RDS_HOSTNAME'] %&gt;
    port: &lt;%= ENV['RDS_PORT'] %&gt;
  </code></pre>
  
  <p>I've also tried messing around with the security groups but nothing really changes</p>
  
  <p>When I try to connect on localhost it gives me </p>
  
  <p>MYSQL2 Error
  Can't connect to MySQL server on 'localhost' (10061)</p>