Welcome Guest, Not a member yet? Register   Sign In
Codeigniter - Unable to connect to your database server using the provided settings.
#1

[eluser]vishpatel1990[/eluser]
Hello Everyone, I have average knowledge of Codeigniter and just started with TankAuth. I had started integrating Codeigniter with TankAuth on Xindows XP using WAMP server. My database.php has following code:
Code:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root123';
$db['default']['database'] = 'project';
$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;

My default controller is 'auth.php' i.e. TankAuth controller. and in its construct, I have initialized database library. I have created database named 'project'. Still, I am getting an error like this:

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

Filename: C:\wamp\www\project\system\database\DB_driver.php

Line Number: 124
I am stuck because of it since two days and unable to find its solution, can anyone tell me what should I do to make it work?
Thanks in advance....
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

That's normally an indication that you're using the wrong credentials, or that your MySQL database isn't running.

Are you able to login with PHPMyAdmin?

Can you access the 'project' database via with PHPMyAdmin?

You didn't mention anything about your server setup.

Is it running on your local machine?

What OS are you running?

Are you running WAMP, XAMPP, MAMP, LAMP, ISS or something else?
#3

[eluser]vishpatel1990[/eluser]
@TheFuzzyOne
Sorry, but I didn't got, what do you mean by wrong credentials. I am using WAMP Server and using Windows XP OS. My MYSQL database is running perfectly on my local machine. I don't have user ID and password and I am able to access the 'project' database via PHPMyAdmin. And since I am new to this, I don't have any idea about server setup. Actually, the place where I am a trainee, they have Ubuntu OS and there is no need for any setup there so I never bothered to look for anything like that.
#4

[eluser]CroNiX[/eluser]
What do you mean by "don’t have user ID and password and I am able to access the ‘project’ database via PHPMyAdmin"? Credentials are the username/password/database. So one or more of them is set wrong.

There is no mysql user account set up that you're using to access the database?

Since you set it up in the CI config, there must be a database user whose username is "root" with the password of "root123" AND that user needs to at least have "select" permissions set up for the 'project' database in order to be able to issue "select" queries. If this is on your local development machine, it's probably ok to give the user FULL permissions. This is done at the database level (creating db users/accounts).
#5

[eluser]vishpatel1990[/eluser]
I do have a account, the username is 'root', password is 'root123' having database named 'project'. And It is showing a list of users that are created when I installed WAMP Server by default. And I have the user that I have mentioned above has been given all permissions. I have attached a screenshot of the same below.
#6

[eluser]vishpatel1990[/eluser]
I do have a account, the username is 'root', password is 'root123' having database named 'project'. And It is showing a list of users that are created when I installed WAMP Server by default. And I have the user that I have mentioned above has been given all permissions. The access permission table for the 'project' database looks something like the one shown below:




Code:
User   Host           Type           Privileges                 Grant        Action
Any     %               global          ALL PRIVILEGES  Yes           Edit Privileges
root    127.0.0.1   global          ALL PRIVILEGES  Yes           Edit Privileges
root     ::1              global          ALL PRIVILEGES  Yes           Edit Privileges
root    localhost    global          ALL PRIVILEGES  Yes           Edit Privileges
#7

[eluser]Unknown[/eluser]
Had the exact same issue which I fixed with: SQL Database Name - localhost, username - root, password - *left this blank, and presto, it installed. Sure you fixed this all ready but for anyone else linking to this post who is a complete noob like myself might find this useful. Cheers




Theme © iAndrew 2016 - Forum software by © MyBB