I have a codeigniter 3 application hosted on cpanel. The database is hosted remotely and I can access it via public ip on localhost without any issue. I have added the app on cpanel and added the remote mysql host ip but i get the error below:
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): Connection refused
Filename: mysqli/mysqli_driver.php
Line Number: 201
Backtrace:
File: /home/*dir*/lms.xxx.com/application/core/MY_Controller.php
Line: 9
Function: __construct
File: /home/*dir*/lms.xxx.com/application/controllers/Login.php
Line: 6
Function: __construct
File: /home/*dir*/lms.xxx.com/index.php
Line: 317
Function: require_once
the database.php file looks like this
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => '41.xx.xxx.xxx',
'username' => 'root username',
'password' => 'root pass',
'database' => 'db name',
'dbdriver' => 'mysqli',
'port' =>3308,
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'development'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
remote access host ip is configured as shared below:
[![access_host_ip][1]][1]
[1]: https://i.stack.imgur.com/Wq5xo.png
Also, on pinging the ip from the cpanel terminal, no response is received. what is the solution to this?