stormrage stormrage - 1 month ago 41
MySQL Question

code igniter error: Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346

I'm developing a website application using codeigniter at localhost and then i host it in hawkhost.

At localhost it runs well, but at host there's and error :


Unable to connect to your database server using the provided settings.
Filename: core/Loader.php Line Number: 346


this is my db configuration

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

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '****';
$db['default']['password'] = '****';
$db['default']['database'] = '****';
$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;


I know many people already asked this problem but it doesn't seems to solve anything on my case.
changing
$db['default']['db_debug'] = TRUE;
to false only hide the error but when i tried to get data from query it doesn't return anything.

I also tried to change
$db['default']['pconnect'] = FALSE;
to true and still doesn't work.

Any help please?

Answer

The problem is really due to credentials. I test it using simple code to check if connection can be made.

The problem is in username, i realize there's additional suffix when using hosting. such as suffix_user I think the same errors in Core/Loader.php Line Number: 346 has the same solution. make sure the username, password and host are right.

It's solved. Thank you everyone for helping.

Comments