title: CodeIgniter - "A Database Error Occurred" (controllers/Login.php)
body: <p>I am trying to configure a webapp using CodeIgniter on MAMP locally, however, I keep getting this error.</p>
  
  <blockquote>
    <p>A Database Error Occurred</p>
    
    <blockquote>
      <p>Unable to connect to your database server using the provided settings.</p>
      
      <p>Filename: controllers/Login.php</p>
      
      <p>Line Number: 8</p>
    </blockquote>
  </blockquote>
  
  <p>This is Line Number: 8 in controllers/Login.php</p>
  
  <pre><code>parent::__construct();
  </code></pre>
  
  <p>This is my database configuration in config/database.php</p>
  
  <pre><code>$db['default'] = array (
      'dsn'   =&gt; '',
      'hostname' =&gt; 'localhost',
      'username' =&gt; '*******',
      'password' =&gt; '*********',
      'database' =&gt; '**************',
      'dbdriver' =&gt; 'mysqli',
      'dbprefix' =&gt; '',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; TRUE,
      'cache_on' =&gt; FALSE,
      'cachedir' =&gt; '',
      'char_set' =&gt; 'utf8',
      'dbcollat' =&gt; 'utf8_general_ci',
      'swap_pre' =&gt; '',
      'encrypt' =&gt; FALSE,
      'compress' =&gt; FALSE,
      'stricton' =&gt; FALSE,
      'failover' =&gt; array(),
      'save_queries' =&gt; TRUE
  );
  </code></pre>
  
  <p>I am very confused. I looked at similar stackoverflow posts, however, my issue is a bit different.</p>
  
  <p>Any help would be appreciated.</p>