0
votes

I read that Bluehost limits the number of database connections from one user to 15. I believe my webapp is using up all those connections. Whenever I try to use the cake console to access the database, I get the following error:

2011-11-29 05:06:58 Warning: Warning (2): mysql_connect() [function.mysql-connect]: User myusername already has more than 'max_user_connections' active connections in [/home2/myusername/public_html/myapp/cake/libs/model/datasources/dbo/dbo_mysql.php, line 561]

How can I make sure there are connections for the cake console to use?

Edit:

Just to be clear, my app is not running out of connections. However, every time I try to access the database from the cake console I get that error. This leads me to believe that cake is creating and holding onto the connections for some reason.

1
Are you sure you haven't configured a persistent database connection in your app/config/database.php? Cake should close that database connection whenever it's done parsing otherwise. Or are you trying to launch more then 15 requests simultaneously?Oldskool
Nope. Not using persistent connections. I'll try to replicate the error in development. var $production = array('driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'prefix' => '', ...);Lawrence Barsanti
You can tell this is the limit of the hosting provider: they are not allowing more than 15 requests at the same time. Maybe you can work it around by caching at some level (avoiding to go to the db each time), but this hosting is obviously not meant to scale.sibidiba

1 Answers

0
votes

If you have the root user account (or with super privileges),
you can change cli script to connect using root,
as root connection even the max connection is reached (max + 1)

You can make use of php_sapi_name to distinguish between normal web access or via console.

I don't think max connection is capped at 15,
if so you should consider another hosting company other than bluehost (because is suck) ...

To verify this, issue a SQL like :-

show variables like "max%";