2014-11-21 106 views
0

我运行WAMP,并尝试连接到数据库,但我得到了笨3错误连接到数据库

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

的FAQ /我做了什么:

  1. 我自动加载在配置数据库库.PHP
  2. 我的phpMyAdmin的没有任何的用户名,并通过设置
  3. 这是database.php中
设置
$db['default'] = array(
    'dsn' => '', 
    'hostname' => 'localhost', 
    'username' => '', 
    'password' => '', 
    'database' => 'ciintro', 
    'dbdriver' => 'mysqli', 
    'dbprefix' => '', 
    'pconnect' => TRUE, 
    'db_debug' => TRUE, 
    'cache_on' => FALSE, 
    'cachedir' => '', 
    'char_set' => 'utf8', 
    'dbcollat' => 'utf8_general_ci', 
    'swap_pre' => '', 
    'autoinit' => TRUE, 
    'encrypt' => FALSE, 
    'compress' => FALSE, 
    'stricton' => FALSE, 
    'failover' => array(), 
    'save_queries' => TRUE 
); 
+0

尝试使用简单index.php中的mysql_connect(),看看是否可行 – 2014-11-21 03:14:50

+0

我解决了这个问题,用户名应该等于'root'。 – 2014-11-21 03:25:09

回答

2

'username' => ''

应该

'username' => 'root'

检查用户名。

0

我认为你是较新的codeigniter。

'用户名'=> '根'(不管你的PHPMYADMIN设置root或)

'密码'=> '密码'(不管你的PHPMYADMIN设置密码或)