When Im swtiching from mysql to mysqli driver, I get too many connection errors. What for?

Why there are too many connection errors:

Message: mysqli_connect (): (08004/1040): Too many connections

when switching from

$db['default']['dbdriver'] = 'mysql';

TO

$db['default']['dbdriver'] = 'mysqli';

in the db codeIgniter configuration file?

Does this mean that the mysqli driver does not close all connections correctly?

UPDATE:

Too many connections appeared when switching the db driver, it seems there was no right reason (as indicated in the answer)

I looked at my web hosting company of clients and they set max_user_connections to 40 (no, not impressive - but I just want to just list users with values ​​using group_concat).

$this->db->select('u.id AS user_id, u.first_name, 
u.housenr, u.address, u.phone, u.garage_nr, u.parking_nr, 
u.standing_correction, u.email, u.note, GROUP_CONCAT(wc.consumption) AS consumption, 
GROUP_CONCAT(wc.id) AS consumption_id, GROUP_CONCAT(wc.consumption_date) AS 
consumption_date, GROUP_CONCAT(wc.working_meetings) AS working_meetings, 
GROUP_CONCAT(wc.nrof_garage) AS nrof_garage, GROUP_CONCAT(wc.nrof_parking) AS nrof_parking, GROUP_CONCAT(wc.correction) AS correction, , 
GROUP_CONCAT(wc.correction_refers) AS correction_refers')->from('water_consumption wc');
$this->db->join('user u', 'u.id = wc.user_id');        
$this->db->join('role r', 'u.role_id = r.id');
$this->db->where('r.name', 'member'); //Only users with members-role        
$this->db->group_by('u.id'); 
$this->db->order_by('LENGTH(housenr), housenr, first_name'); //Natural sorting
$this->db->order_by('consumption_date', 'desc');

$q = $this->db->get();
if ($q->num_rows() > 0) {            
    $res = $q->result('Water_consumption');
    //more code...

, , :

$res = $q->result('Water_consumption');

, 40 , max_user_connections - 40.

$res = $q->result();

, (, Water Consumption).

- , ( 60) 2-3 .

0
2

- ...

,

$res = $q->result('Water_consumption');

.

$res = $q->result();

.

, Water_consumption , . ,

$res = $q->result('Water_consumption');

, .

.

$x = new Water_consumption;
$x = new Water_consumption;

.

+1

MySQL , . wait_timeout, , , . ( 28800 seconds, , -. , .)

, MySQLi p:? Codeigniter , . , ?
. : .

? ( php- - + cronjobs.) , max_connections , . ( - ...)

+1

Source: https://habr.com/ru/post/1541254/


All Articles