在线Codeigniter使用localhost MySql

时间:2012-11-08 02:36:05

标签: mysql codeigniter codeigniter-2

我在计算机上有一个Codeigniter项目,它作为公共访问运行。但是它使用的MySql数据库只能通过localhost访问。当我运行应用程序时,我得到了

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 346

我按照here提到的说明,但我仍然收到同样的错误

Try

1. print_r($params) and print_r($active_record);

2. if the $params are still correct then simplify $active_record

3. echo mysql_error();

4. $db[‘default’][‘db_debug’] = true/false

5. $db[‘default’][‘stricton’] = true/false; 

[编辑]

我已将参数设置为

$db['default']['hostname'] = 'mysql12.freehostia.com';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'myDB';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = false;
$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;

0 个答案:

没有答案