Hey everyone..

Does some one how to setup the settings at the $db. I'm getting an error:::

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

The server's ip address is 192.168.0.109
I can make a connection and see Apache and mysql when I open this address http:\SERVER

The mysql is not working when is have to reload the php in browser in this PHP code


<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "192.168.0.192:3306"; 
$db['default']['username'] = "root";
$db['default']['password'] = "";


$db['default']['database'] = "new";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "new_";
$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";

    If apache and mysql are on the same server, try to use "localhost" as hostname. If it doesnt work, check that user root has access from that ip address.

      I've treid localhost it don't open on server, but on pc browser. The user root have access from the ip address..
      I've also tried the ipaddress:8080 also :3306 and :25

      i've getting the same database error.: Unable to connect to your database server using the provided settings.

        Can you connect to it from the commandline? I dont know the actual connect that you are using but usually you dont have to specify the port.

          It sims that the $db['default']['hostname'] = "192.168.0.192:3306";
          $db['default']['username'] = "root";
          $db['default']['password'] = "";

          is not the right way to connect the database on server.. I've used anothor PHP program with anothor connection like this one :

          $dbhost="192.168.0.109";  
          $dbusername="root"; $dbpassword=""; $dbname="invoice";

          it works fine..

          But not this one:

           $db['default']['hostname'] = "192.168.0.192:3306"; 
          $db['default']['username'] = "root"; 
          $db['default']['password'] = "";

          Now i have a connection problem..

          I will tray to make a new PHP program whit anothor connection to mysql.

            And as another suggested, enter localhost instead of the ip address

            I presume your are running your DB locally?

            $dbhost="localhost";

            $dbusername="root";
            $dbpassword="";
            $dbname="invoice";

              i'm not running it on my local computer. the sql is on a server seperated!! If I run the php query as localhost it will run on my pc and not on the server pc.. But if I put the ip address it will return to the server and make the query there..

              It's the setup of the mysql_connection that sell be need to be changed..

              In my other php program it make the query perfectly, weil the config.php have a mysql_connection with an ip address. so it can by runned from the server to my pc and reload in server...

              New the big questen is how to split the

               $dbhost="localhost"; 
              $dbusername="root";
              $dbpassword="";
              $dbname="invoice"; 

              in to a normal connection, because it have $db..ect and the $db is requred!!

                Write a Reply...