MYSQLi error: User already has more than ‘max_user_connections’ active connections [duplicate]

Probably the problem is that you have only a handful connections allowed and when your class tries to get a new connection you have this error.

This is not a programming problem, just quantity of resources available. And any other script that uses this class are subject to have the error.

You have to configure more connections on mysql config file on the server. If you don’t have this access, ask the support to do it or change for a hosting company with more connections allowed!

Other option is to implement a Singleton pattern on this class, so it reuses same pool of connections, and don’t explode the limit.

Leave a Comment