MySQL: user some_user_name already has more active connections 'max_user_connections'

I use Zend Freamwork for my site. And sometimes I get the following exception from my site:

Message: SQLSTATE [42000] [1203] Elbian user libraries already have more active connections max_user_connections

As I know, Zend Freamwork uses PDO to connect to the database. How can I solve this problem?

+4
source share
3 answers

Always close the connection. If you use the Sql class, it looks like this:

$sql->getAdapter()->getDriver()->getConnection()->disconnect(); 
+2
source

Sometimes MySQL connection threads are not thrown, even if you have completely disassembled the socket; he is still hanging around, waiting for him to reap.

Check the wait_timeout settings. The default value is unreasonably long. The optimal value may be about 20 seconds. You probably also want this to be low if you use persistent connections.

+1
source

Try setting a constant flag in the database driver configuration as false:

 resources.db.params.persistent = 0 
0
source

All Articles