title: Connect to MySQL in MAMP
body: <p>I'm trying to make a HTML form connect to a MySQL database on my MAMP. </p>
  
  <p>However I'm not able to open the MySQL connection. I keep getting the message "Could not connect" </p>
  
  <p>My thoughts for this -</p>
  
  <ol>
  <li>The host is incorrect</li>
  <li>The username and/or password is incorrect. I found this information in config.inc.php, so I believe it is correct, but there's a possibility ..</li>
  </ol>
  
  <p>Here's the PHP script </p>
  
  <pre><code>&lt;?php
  class Database {
      function insert() {
          $dbhost = 'localhost:8888';
          $conn = mysql_connect($dbhost, 'root', 'root');
          if (! $conn) {
              die('Could not connect: ' . mysql_error());
          }
          else {
              echo "connected";
          }
      }   
  }
  </code></pre>
  
  <p>?></p>