User already has more than 'max_user_connections' active connections
I have one shared hosting account and i am running dynamic site there. i am facing below problem sometime where database record returns.
Warning: mysql_connect() [function.mysql-connect]: User myuser already has more than 'max_user_connections' active connections in path/db.php on line 4
Could not connect: User myuser already has more than 'max_user_connections' active connections
I am closing all connections like mysql_close($con) in each file where i execute the query;
is it just because of this ? or there could be some other issue?
can i trace out the problem where i am missing the mysql closing connection ?
If you are sure you are closing connections properly, ask your hosts about the current value of "max_user_connections". If it is too low and the concurrent hits to your website exceeds that threshold, this issue can happen.
increasing the "max_user_connections" value ll not be beneficial if there are opened connections not closed. is there any method to trace opened connection which file or query it belongs to? so i can be 100% ensured about closing connections. there are lot of files but i have closed all connections every where might be somewhere any left. please suggest me something rather than the increasing of max_user_connections value. Regards !
I was not asking to increase the value; I was mentioning a possibility. It will be very difficult to track the exact reason, especially because you are on a shared server and you have no other privileges. Ask your host and they may be able to shed some lights.
The most possible reason we have seen this is due to a rouge query hold up the table and any subsequent queries will wait until the above one releases. You need to check the scripts if this is the case. Ask your host, what exact query it runs at the time you get he error, also what the limit is.
Kevin Cheri : Senior Server Administrator / Freelancer : 9+ years Exp, reach me out for any help Server Optimization Expert / Mysql Guru / Migration Specialist
Skype : lynxmaestro
Gmail : [email protected]