title: CodeIgniter error- unable to connect to database using the provided settings
body: <p>I am new to PHP and CodeIgniter  and I am trying to fetch data from a mysql table using MVC pattern of codeIgniter.</p>
  
  <p>My model class is:</p>
  
  <pre><code>&lt;?php
  
  class News_Model extends CI_Model
  {
  
      public function _construct()
      {
          $this-&gt;load-&gt;database();
      }
  
      public function get_news($id)
      {
          if($id!=FALSE)
          {
              $query= $this-&gt;db-&gt;get_where('news', array('id' =&gt; $id));
              return $query-&gt;row_array();
          }
          else
          {
              return FALSE;
          }   
      }
  
  }
  
  
   ?&gt;
  </code></pre>
  
  <p>and my database.php file is:</p>
  
  <pre><code>  $active_group = 'default';
  $active_record = TRUE;
  
  $db['default']['hostname'] = 'localhost';
  $db['default']['username'] = 'root';
  $db['default']['password'] = '';
  $db['default']['database'] = 'user';
  $db['default']['dbdriver'] = 'mysql';
  $db['default']['port'] = '3306';
  $db['default']['dbprefix'] = '';
  $db['default']['pconnect'] = TRUE;
  $db['default']['db_debug'] = TRUE;
  $db['default']['cache_on'] = FALSE;
  $db['default']['cachedir'] = '';
  $db['default']['char_set'] = 'utf8';
  $db['default']['dbcollat'] = 'utf8_general_ci';
  $db['default']['swap_pre'] = '';
  $db['default']['autoinit'] = TRUE;
  $db['default']['stricton'] = FALSE;
  </code></pre>
  
  <p>But when I run my file, it shows the following error:</p>
  
  <pre><code>Unable to connect to your database server using the provided settings.
  
  Filename: C:\wamp\www\codeignite\system\database\DB_driver.php
  
  Line Number: 124
  </code></pre>
  
  <p>My mysql is up and running but still i am not able to figure out the cause for this error.</p>