dongsou0083
2017-07-21 10:07
浏览 94
已采纳

Codeigniter:发生数据库错误无法使用提供的设置连接到数据库服务器

I have this new error when i added a new project in htdoc file of xampp and when I run it the is giving me the database error occurred here is my database file

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

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',  //ewfcbrhv_user
    'password' => 'sal123',  // aots123!321
    'database' => 'splendrz ',  //ewfcbrhv_aots
    '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
);

and it is giving me this error

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

Filename: E:/xampp/htdocs/aots/application/controllers/Home.php

Line Number: 8

kindly help as today is I am first day in the office and i'm stuck here on this error

图片转代码服务由CSDN问答提供 功能建议

当我在xampp的htdoc文件中添加一个新项目时,我遇到了这个新错误,当我运行它时,它给出了 我发生了数据库错误 我的数据库文件

  $ active_group ='default'; 
 $ query_builder = TRUE; 
 
 $ db ['default']  = array(
'dsn'=>'',
'hostname'=>'localhost',
'username'=>'root',// ewfcbrhv_user 
'password'=>'  sal123',// aots123!321 
'database'=>'splendrz',// ewfcbrhv_aots 
'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,  
'triminon'=> FALSE,
'failover'=> array(),
'save_queries'=> TRUE 
); 
   
 
 < 它给了我 是错误 
 
 

无法使用提供的设置连接到数据库服务器。

文件名: E:/xampp/htdocs/aots/application/controllers/Home.php

行号: 8

请帮助,因为今天是我在办公室的第一天,我被困在这个错误

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doumou3883 2017-07-21 10:25
    已采纳

    Check the following -

    1. Is the password of your database entered in the config correct? ('sal123')?
    2. Does the database named - 'splendrz ' exist in your local mysql instance? Also, there seems to be a trailing space in this name. Most likely you need to remove that. ['splendrz'].
    3. If none of these work, check your error.log (apache error log) file for more clues.
    已采纳该答案
    打赏 评论
  • duancenxie2233 2017-07-21 10:41

    Change 'dbdriver' => 'mysqli',

    to

    'dbdriver' => 'mysql',
    

    or to

    'dbdriver' => 'pdo',
    

    I think it work.

    打赏 评论

相关推荐 更多相似问题