Welcome Guest, Not a member yet? Register   Sign In
Error conecting to external DB
#1

(This post was last modified: 06-16-2020, 12:31 PM by rav1971.)

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




Theme © iAndrew 2016 - Forum software by © MyBB