title: Codeigniter database error on MX/loader.php line 99
body: <p>I have recently copied a codeigniter website over to a new domain with a new database, at first the coding was set to the old db as it was a straight copy and all was running fine. I created a new DB and imported all tables from the old, then changed all the DB details in the config database file. I am confident all details are correct and I have set my new user to all privileges. But now my site fails with the following:</p>
  
  <pre><code>  Unable to connect to your database server using the provided settings.
  
  Filename: root/third_party/MX/Loader.php
  
  Line Number: 99
  </code></pre>
  
  <p>Which looks like this in my MX/Loader.php file</p>
  
  <p>/** Load the database drivers **/</p>
  
  <pre><code>public function database($params = '', $return = FALSE, $active_record = NULL) {
  
      if (class_exists('CI_DB', FALSE) AND $return == FALSE AND $active_record == NULL AND isset(CI::$APP-&gt;db) AND is_object(CI::$APP-&gt;db)) 
          return;
  
      require_once BASEPATH.'database/DB'.EXT;
  
      if ($return === TRUE) return DB($params, $active_record);
  
      **CI::$APP-&gt;db = DB($params, $active_record);**
  
      return CI::$APP-&gt;db;
  }
  </code></pre>
  
  <p>Line 99 is highlighted with the ** at each end. I can't figure out where the issue is, I've searched the likely files and found nothing pointing to the old db or that looks like it's in need of pointing to the new. Any help greatly appreciated! Cheers.</p>