Welcome Guest, Not a member yet? Register   Sign In
Problem with Forge createDatabase
#1

I'm using CI 4.0.3
I get an exception 'unknown database 'ikl70fxb_TestDB' ' when I try to create a database defined in my default configuration.

I can make it work by creating another configuration called 'info' and setting 
'database' => 'information_schema' and then passing it to [font=Monaco, Consolas, Courier, monospace]$forge = \Config\Database::forge('info'); [/font]

This is my database config:
PHP Code:
    public $default = [
        
'DSN'      => '',
        
'hostname' => 'localhost',
        
'username' => 'ikl70fxb_root',
        
'password' => '123abc',
        
'database' => 'ikl70fxb_TestDB',
        
'DBDriver' => 'MySQLi',
        
'DBPrefix' => '',
        
'pConnect' => false,
        
'DBDebug'  => (ENVIRONMENT !== 'production'),
        
'cacheOn'  => false,
        
'cacheDir' => '',
        
'charset'  => 'utf8',
        
'DBCollat' => 'utf8_general_ci',
        
'swapPre'  => '',
        
'encrypt'  => false,
        
'compress' => false,
        
'strictOn' => false,
        
'failover' => [],
        
'port'     => 3306,
    ]; 


This is how how I call it:
PHP Code:
        $forge = \Config\Database::forge();
        $forge->createDatabase('ikl70fxb_TestDB',TRUE); 

Any ideas?
Reply


Messages In This Thread
Problem with Forge createDatabase - by Ken McClain - 06-20-2020, 08:38 AM
RE: Problem with Forge createDatabase - by Chroma - 07-30-2021, 04:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB