EllisLab text mark
Advanced Search
     
Unable to connect to your database server using the provided settings Error message
Posted: 31 August 2011 04:49 AM
Joined: 2011-07-15
16 posts

Hey all,

I have been using CI just fine using the MySQL driver. I want to use the mysqli driver instead, but as soon as I change it (just add the ‘i’ at the end of mysql, and added the port number) I get the following error message

A Database Error Occurred

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

Filenamecore/Loader.php

Line Number
232 

my setting look like this:

$db['default']['hostname'$hostname;
$db['default']['username'$username;
$db['default']['password'$password;
$db['default']['database'$database;
$db['default']['dbdriver''mysqli';
$db['default']['port']     "3306";  
$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

where

$hostname 'localhost';
$username 'myusernamegoeshere';
$password 'mypasswordgoeshere';
$database 'mydatabasenamegoeshere'

Using:
CI 2.0.2
php 5.3.4
Apache/2.2.17 (Unix)
mysql 5.5.13
mysql.default_port 3306

Am I doing anything wrong?

Thank you,

Juan

 
Posted: 31 August 2011 06:09 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2010-07-16
530 posts

Did you check that you have good MySQL server version? According to PHP website:

“The mysqli extension is designed to work with MySQL version 4.1.13 or newer, or 5.0.7 or newer. For previous versions, please see the MySQL extension documentation.”

Cheers,
Smilie

 
Posted: 31 August 2011 03:25 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-07-15
16 posts

this is what if found under phpinfo: http://d.pr/FUZ6

 
Posted: 31 August 2011 03:56 PM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-12-08
1804 posts

In DB_driver.php, locate:

$this->display_error('db_unable_to_connect'); 

And above it, add:

die(mysqli_connect_error()); 

To see the specific connection error

 Signature 

@basdflasjk | BitAuth: Authentication and Role-based Permissions | Session Library Replacement


Please read the User Guide! (Upgrading from a previous version?)

 
Posted: 02 September 2011 03:25 PM   [ # 4 ]   [ Rating: 0 ]
Joined: 2011-07-15
16 posts

the message I get is

No such file or directory 

Am I missing a file?

this is what my database dir tree looks like

http://d.pr/OgYY

 
Posted: 02 September 2011 03:47 PM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2009-12-08
1804 posts

Do you have the php mysqli extension enabled?

 Signature 

@basdflasjk | BitAuth: Authentication and Role-based Permissions | Session Library Replacement


Please read the User Guide! (Upgrading from a previous version?)

 
Posted: 02 September 2011 04:08 PM   [ # 6 ]   [ Rating: 0 ]
Joined: 2011-07-15
16 posts
danmontgomery - 02 September 2011 07:47 PM

Do you have the php mysqli extension enabled?

I think so, see my previous comment,

Juan Torres - 31 August 2011 07:25 PM

this is what if found under phpinfo: http://d.pr/FUZ6

should I be looking for something else?

Thank you for the quick response!!