• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error conecting to external DB

#1
I have this error when iI try to connect to external DB:

Severity: Warning --> mysqli::real_connect(): (HY000/2002): Connection refused system/database/drivers/mysqli/mysqli_driver.php 202

I am sure credentials are Ok and if I use this code to check if I can connect:

PHP Code:
$servername "servername.com";
$username "username";
$password "password";
$database "database";

// Create connection
$conn mysqli_connect($servername$username$password$database);

// Check connection
if (!$conn) {
    die("Connection failed: " mysqli_connect_error());
}

echo 
"Connected successfully"

I always got "Connected successfully"

This is my configuration:


Quote:$db['mydb'] = array(
'dsn' => '',
'hostname' => 'servername.com',
'username' => 'username',
'password' => 'password',
'database' => 'database',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE, // or FALSE doesn't make difference
'db_debug' => '',
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);



Any advise?
Reply

#2
@ rav1971,

Have you looked up the error message? Also, when you said that you always got "Connected successfully" was your PHP and server versions and settings that same between the two systems? Did something change PHP, Mysql versions?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.