TulipTools Internet Business Owners and Online Sellers Community

Full Version: What to Do if You Get a "Too Many Connections" Message On A MySQL-Driven Site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
By default, most MySQL databases are installed with the maximum number of connections set to 100. You can verify the settings for your server by running the command mysqladmin variables and looking at the max_connections setting.
If you or your visitors frequently get a "too many connections" error message when trying to connect to your MySQL driven site you can add the following code to your /etc/my.cnf file to increase the number of connections. (You can set the number to higher than 250 connections but be aware of memory limitations). Restart MySQL after adding the code.

Code:
[mysqld]
set-variable=max_connections=250
Quote:mysqladmin variables


if you're able to type in that exact command and find out the maximum number of connections you probably have realllly crappy security and you might want to think about using a password.  :twistedevil:

Those of you who thought to password protect mysql will probably type: mysqladmin variables -p  :twistedevil:  Yellowtonguerazz
Making these 2 changes help prevent some too many connections errors too if you're running php scripts

change persistent to off in php.ini

Code:
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent=Off

or add this to .htaccess

Code:
php_value mysql.connect_timeout 20
Quote:persistent

...and if you're using oscommerce and are on a shared server don't use persistent because your hosting company won't  like you.  Nono