I have a new CI 1.6.1 install. In my application/config/database.php file I have the host, username, pass, and db names set. The MySQL is version 5.0.2. I have other CI based sites running, and have gotten database connectivity no problems. When I call
$this->load->database()
From a controller or model, I get: “Unable to connect to your database server using the provided settings.”
However, if I just use the raw PHP:
mysql_connect('mysql.myhost.com','myuser','mypass') or die("uh oh: ".mysql_error());
mysql_select_db('mydb') or die("no db: ".mysql_error());
It connects fine, and I can run queries and all is well. I have copy / pasted the working values from the raw PHP into the database.php file, so it’s not a typo or anything of that nature.
That file looks like:
$db['default']['hostname'] = "mysql.myhost.com";
$db['default']['username'] = "myuser";
$db['default']['password'] = "mypass";
$db['default']['database'] = "mydb";
$db['default']['dbdriver'] = "mysql";
$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";
php.ini confirms that persistant connections are enabled, charset and collation match.
This is my first 1.6.X site (all my other CI sites are 1.5.x) so is there some “duuuh” setting somewhere I need to set, or?