简体   繁体   中英

Unable to connect to database in Amazon RDS from codeigniter 3

I'm using these configs in my database.php file

$db['testing'] = array(
'dsn'   => '',
'hostname' => '----RDS HOST LINK------',
'username' => 'XXXX',
'password' => 'XXXX',
'database' => 'test_db',
'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
);

I'm getting a message that I'm not able to connect using the provided settings.

However if i change the dbdriver to mysql, it states "Unable to select the specified db test_db".

I tried setting up a persistant connection as well, using pconnect to true, still no luck.

I'm able to connect to the rds using those credentials from mysql workbench and i created and dump the data into test_db as well. Dont know whats wrong with codeigniter. The MySQL ports are also open in RDS security group(obviously).

Its the first time I'm facing such issue. What could have gone wrong?

Got it to work.

Created a new security group and made the port open, and restarted the RDS server. Somehow it worked. Still dont know what went wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM