Forum Moderators: coopster

Message Too Old, No Replies

having multiple dbusers access the db

dbuser multiple

         

petulantpoetess

10:26 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



I have a fair amount of traffic on my site. Every time someone clicks on a link, the database is accessed. Occasionally I have a problem with error messages such as this:

Warning: mysql_connect(): Too many connections in /home/thesite/data/dbconfig.php on line 8

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/thesite/data/dbconfig.php on line 9

Warning: mysql_query(): Access denied for user: 'root@localhost' (Using password: NO) in /home/thesite/public_html/page.php on line 1117

Warning: mysql_query(): A link to the server could not be established in /home/thesite/public_html/page.php on line 1117

So, my question is, how can I set up my dbconfig file to use more than one dbuser with the same database? Such as, if one dbuser doesn't work, try the other?

This is what I have now:

<?php

$dbhost = 'localhost';
$dbuser = 'thesite_user';
$dbpass = 'password';
$dbname = 'thesite_db1';

$mysql_access = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $mysql_access);

?>

Any ideas or solutions would be greatly appreciated. ;)

PP

jatar_k

10:30 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the key is always in the first error

"Too many connections"

you have a limited number of connections from any given host, you could ask them what your limit is and how you would go about increasing it. This isn't necessarily bound by user.

If you can't then maybe having less db accesses will be necessary.

[dev.mysql.com...]

petulantpoetess

11:03 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



Thanks for that link. I will bookmark it and keep it for future use.

In the meantime, I have two header files, one for users and one for admins. I just created a second dbconfig file and set that up with a different dbuser. We admins put a lot of strain on the system, forcing it to do multiple processes, so I think this will help a little.