Home Ask Login Register

Developers Planet

Your answer is one click away!

Melroy Fernandes February 2016

Codeigniter Framework Database Error

I am getting the following error in the Codeigniter MVC framework project.

Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\citizen\system\database\DB_driver.php
Line Number: 125

any idea how do I debug this.


Keith Ivison February 2016

if you go to the 'application/config' directory and open database.php at about line 51 you will see

$db['default']['hostname'] = 'The hostname of your database server';
$db['default']['username'] = 'The username used to connect to the database';
$db['default']['password'] = 'The password used to connect to the database';
$db['default']['database'] = 'The name of the database you want to connect to';

Fill in these to match your settings. your hostname will be 'localhost', the rest is what you set at the time. Hope that helps Regards Keith

Vasim Vanzara February 2016

Just for debugging your problem:

Go to system/database/mysql/mysql_driver and in db_connect method delete the @ from @mysql_connect($this->hostname, $this->username, $this->password, TRUE);

That will show you what is wrong with the database.

Post Status

Asked in February 2016
Viewed 1,973 times
Voted 7
Answered 2 times


Leave an answer

Quote of the day: live life