Codeigniter Mysql:连接太多

时间:2017-06-22 05:56:36

标签: codeigniter-3

我收到以下错误:

消息:mysqli :: real_connect():( 08004/1040):连接太多

这是我的数据库配置的代码

$db['default'] = array( 'dsn'   => '',
 'hostname' => 'localhost', 
 'username' => 'root', 
 'password' => '', 
 'database' => 'gatha_data', 
 // 'database' => 'storegrunt-dev', 
 '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 ); 

请尽早回复

1 个答案:

答案 0 :(得分:0)

您可以使用以下语法在主配置文件(例如/etc/my.cnf)中增加此值:

[mysqld]
set-variable=max_connections=250

你也可以改变php.ini文件

; Allow or prevent persistent links.
mysql.allow_persistent=Off

或者您可以设置

'pconnect' => TRUE,