title: Cannot Connect from PHP script to AWS database
body: <p>I'm trying to connect to an aws rds that I created. I can connect no problem using MySQL Workbench but not from the PHP script which I have uploaded to a server. I have a feeling it is something to do with the permissions but I am not sure. Could someone point me in the right direction. Below is the PHP code I am using</p>
  
  <pre><code>&lt;?php
  //Database configuration
  
  $dbhost = $_SERVER['https://address.to.aws.rds/rds/home?region=us-west-2'];
  $dbport = $_SERVER['3306'];
  $dbname = $_SERVER['test_db_name'];
  
  $dsn = "mysql:host={$dbhost};port={$dbport};dbname={$dbname}";
  $username = $_SERVER['username'];
  $password = $_SERVER['password'];
  
  $dbh = new PDO($dsn, $username, $password);
  }
  </code></pre>
  
  <p>The error I get when I upload and run this script is</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)' in /home2/betamath/public_html/graspe/db.php:12 Stack trace: #0 /home2/betamath/public_html/graspe/db.php(12): PDO-&gt;__construct('mysql:host=;por...', NULL, NULL) #1 {main} thrown in /home2/betamath/public_html/graspe/db.php on line 12
  </code></pre>
  
  <p>Line 12 is <code>$dbh = new PDO($dsn, $username, $password);</code></p>
  
  <p>The permissions I have set up for the aws rds are</p>
  
  <pre><code>HTTP            TCP      80      0.0.0.0/0
  
  SSH             TCP      22      0.0.0.0/0
  
  MySQL/AURORA    TCP      3306    0.0.0.0/0
  
  HTTPS           TCP      443     0.0.0.0/0
  </code></pre>
  
  <p>Again, any help is much appreciated. Thanks</p>