Jump to content

Can more than one user be attached to MySQL database?


dmirsch

Recommended Posts

I'm having the following error sometimes when we open our webpage which is an extremely database-driven website:

User wilma already has more than 'max_user_connections' active connections
Our hosting MySQL server is a shared hosting package and we are allotted 10 users. Our hosting server suggests we obtain a VPS where we are allowed to change that number ourselves, but with the shared package we cannot change this. (FYI>I have changed the error message for public viewers to give them a work-around link so that no one sees this error message any longer.)

 

Before we change our current hosting package, I am looking for some answers to the following questions or some suggestions on the route I can take with our current set-up.

 

1. When someone accesses any database-drive webpage on our website, the PHP opens the connection to the database, runs the query, then close the connection. Does this mean that if more than 10 people are looking at our website at one given time, someone will get this error message? If the database connection is closed right away, then theoretically can we be OK since the connection closes after it has grabbed the info from the database to display the page?

 

2. Both of our homepages have an image carousel on them. This carousel opens the connection, runs the query, then closes the connection. Since the carousel is constantly running, does it open the connection once and grabs all 93 images, or does it open the database each time and so there is a constant open/close connection? I think the answer is that it grabs all the images at once, but here's the code that runs the carousel:

<?php OPEN DATABASE/RUN-QUERY CODE DELETED ?>
<?php
echo '<div id="slider"><ul id="sliderContent">';
while ($Row = mysqli_fetch_assoc($Result)){
	$EventName = $Row['EventTitle'];
	$url = $Row['EventLink'];
	$image = $Row['eImage'];
	$description = $Row['BriefDescription'];
	$promoter = $Row['Presenter'];
	$starting = $Row['startDATE'];
	$ending = $Row['endDATE'];
	echo '<li class="sliderImage"><a href="' . $url . '"><img src="https://myurl.com/' . $image . '" alt="' . $EventName. '" title="' . $EventName . '" height="400" width="900" border="0" /></a><span class="right"><strong>' . $EventName . '</strong><br /><em><br />Presented by ' . $promoter . '</em><br />' . date("l, F j, Y", strtotime($starting));

	if ($starting != $ending){ /**IF STARTING=ENDING =>NO ENDING SHOWN **/
		echo '<br />to ' . date("l, F j, Y", strtotime($ending));
	}

	echo '<br /><br />' . $description . '<br /><br /><a href="' . $url . '"><img src="https://myurl.com/z_BUY_Tickets_gold.gif" height="40" width="100" border="0" align="right" alt="' . $EventName . '" title="' . $EventName . '" /></a></span></li>';
}
echo '<div class="clear sliderImage"></div></ul></div>';
?>
<?php
mysqli_free_result($Result);
mysqli_close($DB);
}
?>        

 

2. Is it possible to create multiple usernames and passwords for one database? If it's possible and I do this, would that alleviate the issue? So for example, if I create another user (fred) and have another webpage use that to connect would that mean then I have 20 people able to look at our website -- 10 for wilma and 10 for fred?

 

3. If we got a VPS for our database server, how different is administering that as compared to administering an exchange server for our emails/file-sharing? We have an IT guy who's is very good at the exchange server on staff, but if it is something totally different, then it appears that we would need to contract this out and that runs into budget issues. Not sure if we have budget for this...of course our website runs 60%-75% of our revenue, so we probably could find the budget if needed.

 

Thanks in advance for any answers/suggestions you may offer. I wish that our company would just give me more schooling on PHP/MySQL!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.