http://www.php230.com/codeigniter-appear-unable-to-connect-to-your-database-server-using-the-provided-settings-error.html
解决过程:
在config/database.php最后加上如下代码进行调试。
echo '<pre>';
print_r($db['default']);
echo '</pre>';
echo 'Trying to connect to database: ' .$db['default']['database'];
$dbh=mysql_connect
(
$db['default']['hostname'],
$db['default']['username'],
$db['default']['password'])
or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ($db['default']['database']);
echo '<br /> Connected OK:' ;
die( 'file: ' .__FILE__ . '--> Line: ' .__LINE__);
输出后发现 , 提示:不能连接数据库。 改正确后, hostname 应该是远程数据库地址