CodeIgniter Forums
Connecting to remote database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Connecting to remote database (/showthread.php?tid=84853)



Connecting to remote database - Zakk - 11-16-2022

I have been with trying to connect to a remote database all day. I have given remote access to a user and I can connect from my terminal but my application can't connect to the remote database. Please I need any form of help. I am new to codeigniter and I really need to work on this project


RE: Connecting to remote database - richb201 - 11-22-2022

Zakk, I connect to AWS RDS. I do this by setting the connection params in the database.php in the config dir.

$db['default'] = array(
'dsn' => '',
'hostname' => 'database-2.ast-1.rds.amazonaws.com',
'username' => 'adn',
'password' => '1b3o',
'database' => 'subator',
'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(),
'save_queries' => TRUE
);

You also need to use this in your code:

$this->load->database();


RE: Connecting to remote database - InsiteFX - 03-30-2023

READ:

How Do I Enable Remote Access To MySQL Database Server?