Jump to content

Max User Connections, Mysql.


Xoviat

Recommended Posts

I've been getting a fair amount of max user connection errors in mysql lately.

 

I imagine that most of this is due to how I'm currently using mysql. I currently have 4 databases, and I'm opening/closing connections a lot. This is because I wish to make nifty classes/interfaces that I can slap into any future project with independent DBs. I'm guessing after almost OCD level code review that mysql can't keep up at times as the error appears at random points in execution.

 

I can of course whack everything into the same DB, but that defeats the purpose of what I eventually wish to accomplish.

 

Anyhow, I noticed that max user connections is set to 2. Would there be a huge impact to the server if this was increased to 3? I imagine this would solve my problem. If not, I'll just make the necessary changes, but it would be nice if possible.

Link to comment
Share on other sites

Do all of your different DBs have different users and passwords? If they all use the same user then you only need to open one connection and select the database needed to perform whatever task. Example:

<?php
$dbcon = mysql_connect("localhost","user","password");

mysql_select_db("db2", $dbcon);
// action on DB1

mysql_select_db("db2", $dbcon);
// action on DB2

mysql_close($dbcon);
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...