CodeIgniter Forums
Database Error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Database Error (/thread-23231.html)



Database Error - El Forum - 10-04-2009

[eluser]Ghavin[/eluser]
I cant figure this one out of course I am new but I know how to test my database connectivity but this it is totally new on how to do it with CI. I keep getting this message in my browser.


A Database Error Occurred

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



Database Error - El Forum - 10-04-2009

[eluser]pistolPete[/eluser]
You need to enter the correct database settings, see the user guide:
http://ellislab.com/codeigniter/user-guide/database/configuration.html


Database Error - El Forum - 10-04-2009

[eluser]Ghavin[/eluser]
Thanks pistolPete I have tryed the information that you guided me to and I still get the same message as before. here is my database login info.

Code:
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "ci_series";
$db['default']['dbdriver'] = "mysql";
$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";

Is this correct or am I doing somthing wrong, Keep in mind I am only learning this just now. Thanks


Database Error - El Forum - 10-04-2009

[eluser]pistolPete[/eluser]
Does the native php connection work?
Code:
<?php
$link = mysql_connect('localhost', 'root', 'root');
if (!$link)
{
    echo('Could not connect: ' . mysql_error());
}
else
{
     echo 'Connected successfully';
     mysql_close($link);
}



Database Error - El Forum - 10-04-2009

[eluser]Skuja[/eluser]
We don't now your database settings, neither you should show this data in public.
Try to connect to your databse the old way:
create plain .php file and check if you can connect [i assume you are using mysql]
Code:
$con = mysql_connect("localhost","root","root");
if (!$con)
{
   die('Could not connect: ' . mysql_error());
}
mysql_select_db("ci_series", $con);
mysql_close($con);



Database Error - El Forum - 10-04-2009

[eluser]Ghavin[/eluser]
[quote author="pistolPete" date="1254693873"]Does the native php connection work?
Code:
<?php
$link = mysql_connect('localhost', 'root', 'root');
if (!$link)
{
    echo('Could not connect: ' . mysql_error());
}
else
{
     echo 'Connected successfully';
     mysql_close($link);
}
[/quote]


I see I have tried this and it could not connect so it is dealing with my server it tells me this at the bottom of my PHPmyadmin.

Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.33. This may cause unpredictable behavior.


Database Error - El Forum - 10-04-2009

[eluser]therealmaloy[/eluser]
@ghavin

this might be compatibility issues...

you might be using an older version of CI codes in a new PHP5.3.x and MySQL5.1.x systems...

i noticed this error also a week ago when i did install the newer version and plugged in my older CI 1.7.0 and/or CI 1.7.1.

try using CI 1.7.2 this might help, if not lower the version of your PHP and MySQL.

hope this helps.


Database Error - El Forum - 10-04-2009

[eluser]Ghavin[/eluser]
Ok, That I will try thanks therealmaloy and everyone else for your time I look foward to one day helping you with an issue.