CodeIgniter Forums
Second base in ENV - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Second base in ENV (/showthread.php?tid=84925)



Second base in ENV - motoroller - 11-23-2022

i have settins in ERV
for the first database is ok default group

but when i added second one
and try to connect
i got next "second is not a valid database connection group."

if i add to config empty second

public $first= [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8',
'DBCollat' => 'utf8mb4_unicode_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
];

public $second= [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
];

i got Main connection [MySQLi]: Access denied for user ''@localhost (using password: NO)
i think CI can get info about second database from ENV


database.default.hostname = localhost
database.default.database = first
database.default.username = root
database.default.password = root
database.default.DBDriver = MySQLi
database.default.port = 3306

database.animalface.hostname = localhost
database.animlaface.database = second
database.animlaface.username = root
database.animlaface.password = root
database.animlaface.DBDriver = MySQLi
database.animlaface.port = 3306