Jump to content

[Solved] User mrj_user already has more than 'max_user_connections' active connections


Recommended Posts

Posted

Why I am getting following error:

SQLSTATE[HY000] [1203] User mrj_user already has more than 'max_user_connections' active connections
I guess it is something about sql connections are eating up by scripts. I want to know how and which scripts are responsible. Please admins, help me.
Posted

Also, a lot of users forget to close the mysql connections when they have finish working on it. So that maybe the problem you forget to close the mysql connections and that is why you got that error.

Posted

My db class have a __destruct function which is closing database connection.

Posted

But I get this error too often. Any suggestion how I monitor and fix this problem?

Posted

It's either your script, or you're receiving too much concurrent traffic. I see this error quite a bit with the HelioMine/RGS API that I run, and it's caused by too many clients hitting it at once (in my case the occasional failure from too many connections is acceptable since the clients retry on their own).

 

You mentioned closing your connections in __destruct()...does your script open more than one though? Just because it's closing them doesn't mean it won't run out of connections while running. Open a single connection at startup, and reuse that connection throughout the entire program. Close it on exit. Avoid doing things like opening a new connection for each instance of a class and closing it when the object is destroyed.

 

If it's the second issue, it means you've outgrown shared hosting (very easy to do if you're receiving a decent amount of traffic and use heavy software) and should consider buying a VPS instead. While it's not free, you get full root access to do whatever you please, so running out of connections won't be an issue.

Posted

I get that error often too when i work with workbench , I solve my problem by logging in to phpmyadmin in my Cpanel and execute the command "show processlist;" , then I kill those connections in the "kill" option

Guest
This topic is now closed to further replies.
×
×
  • Create New...