• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to connect to database - cannot find error messages

#1
I'm trying to connect a CI4 app to a DigitalOcean managed database. I have probably configured something wrong, but I am having a really hard time finding out what because I can't find any error messages from the database server. Is there anywhere in the debugger or in the logs where I can find the response from the database server?

How do I know if CI has sent a query, if it has received a response, and what that response is?

The debugger shows this error: CodeIgniter\Database\Exceptions\DatabaseException #8. Unable to connect to the database

The writable/logs log shows this error: CRITICAL - 2020-09-06 06:01:02 --> Unable to connect to the database.

For reference, here is my code:

PHP Code:
$this->db = \Config\Database::connect();

$this->db->query('INSERT INTO users (1, "user")'); 

Here is my db configuration (with sensitive info removed):

PHP Code:
public $default = [
    
'DSN'      => '',
    
'hostname' => '[unique address].ondigitalocean.com',
    
'username' => '[username]',
    
'password' => '[password]',
    
'database' => '[database]',
    
'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'     => 25060,
]; 

I have successfully connected using this login info with MySQL Workbench.
Reply


Messages In This Thread
Unable to connect to database - cannot find error messages - by infidev - 09-06-2020, 10:15 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.