lundi 16 juillet 2018

CodeIgniter fail connect to database using IP Address

I want to connect to database in CodeIgniter using local IP address but it failed,

config/database:

$active_group = 'default';
$query_builder = TRUE;
$active_record = TRUE;

$db['default'] = array(
'dsn'   => '',
'hostname' => '192.168.1.102',
'username' => 'root',
'password' => '',
'database' => 'webbmkg',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(
    array(
        'dsn'   => '',
        'hostname' => '192.168.1.103',
        'username' => 'root',
        'password' => '',
        'database' => 'webbmkg',
        'dbdriver' => 'mysqli',
        'dbprefix' => '',
        'pconnect' => FALSE,
        'db_debug' => (ENVIRONMENT !== 'production'),
        'cache_on' => FALSE,
        'cachedir' => '',
        'char_set' => 'utf8',
        'dbcollat' => 'utf8_general_ci',
        'swap_pre' => '',
        'encrypt' => FALSE,
        'compress' => FALSE,
        'stricton' => FALSE,
        'save_queries' => TRUE
    )
),
'save_queries' => TRUE
);

screenshot error

where my local IP address is 192.168.1.102, but when I change the IP to "localhost" its work.

Actually I want to using IP address from another PC for the failover but its not working, and then I change my default database using IP address its not working too. I think something wrong but I dont know what is that.




Aucun commentaire:

Enregistrer un commentaire