MySQL: User some_user_name already has more than 'max_user_connections' active connections
I'm using Zend Freamwork for my website. And sometimes i get the following exception from my website:
Message: SQLSTATE[42000] [1203] User elibrary_books already has more than '开发者_开发百科max_user_connections' active connections
As I know "Zend Freamwork" uses PDO to connect to the database. How i can resolve this problem?
Always close your connection. If you are using Sql class it looks like:
$sql->getAdapter()->getDriver()->getConnection()->disconnect();
Sometimes MySQL connection thread is not thrown away even though you've torn down the socket cleanly; it still hangs around waiting for it to be reaped.
Check your settings for wait_timeout
. Default value is unreasonably long. Optimal value might be around 20 seconds. You will probably also want it this low if you're using persistent connections.
Try setting the persistent flag in your database driver configuration to be false:
resources.db.params.persistent = 0
精彩评论