简体   繁体   中英

Unable to connect to your database server using the provided settings.in Codeigniter?

below is my database settings but that will give me following error

Unable to connect to your database server using the provided settings

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost:9880';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'codeignitor';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$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;

Can anyone tell me where i am wrong. Please help

$db['default']['hostname'] = 'localhost:9880';

Your problem is there. That's not where the port number goes. It goes in $db['default']['port'] .

$db['default']['hostname'] = 'localhost';
$db['default']['port'] = '9880';

Docs: http://ellislab.com/codeigniter/user-guide/database/configuration.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM