2015-09-02 28 views
0

我使用笨,我无法连接我的数据库,给我一个错误: Error connecting database错误连接MySQL数据库和PHP笨

我只是添加库在autoload.php:

`$autoload['libraries'] = array('database');` 

,这是我在database.php中

$active_group = 'default'; 
$query_builder = TRUE; 

$db['default'] = array(
    'dsn' => '', 
    'hostname' => 'localhost', 
    'username' => 'root', 
    'password' => 'root', 
    'database' => 'heroes', 
    'dbdriver' => 'mysqli', 
    'dbprefix' => '', 
    'pconnect' => FALSE, 
    'db_debug' => (ENVIRONMENT !== 'production'), 
    'cache_on' => FALSE, 
    'cachedir' => '', 
    'char_set' => 'utf8', 
    'dbcollat' => 'utf8_general_ci', 
    'swap_pre' => '', 
    'encrypt' => FALSE, 
    'compress' => FALSE, 
    'stricton' => FALSE, 
    'failover' => array(), 
    'save_queries' => TRUE 
); 

设置:S任何帮助吗?

+0

改变本地主机你加什么库?你在application/config/database.php里面有什么设置?请给一些更多的细节。 – cssBlaster21895

+0

我刚更新了 –

+0

你有没有对index.php做任何修改,可能是错误的系统路径?没有数据库库的应用程序工作吗? – cssBlaster21895

回答

1

只是我的127.0.0.1:3306

+0

但这是答案......:S –