“Too many connections” error in Mysql

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


8 points

I am getting "too many connections" error when my drupal appliation try to connect to the mysql server. I don't seem to be having too much traffic and this error seems to surprize me. I have browsed over the web, but could not find a reason that solves this issue. Any help is appreciated.

David



1 point

You're probably going to have to look at how Mysql is tuned on your server - apparently you're opening more mysql connections than your mysql server is set up for. So you're going to have to understand basic mysql tuning - start by reading the /etc/my.cnf file on your server (assuming this is a UNIX-ish server of some sort) and the corresponding pages at the mysql site.. You should probably set up some tools for looking at your mysql database configuration and tuning it, such as mysqltuner.

Anonymous's picture
Created by Anonymous
13 points

Try running "show processlist" when this happens (you get "too many connections" error). If you have too many locked tables, the convert your tables to innodb. Drupal by default comes with MyISAM which locks tables when updating them. Converting them to Innodb does record level locking, thus making the system fast.

Anonymous's picture
Created by Anonymous
4 points

I successfully ran "show processlist" when I was getting "too many connections" error and I was indeed having too many locked tables. I changed them Innodb, but that didn't help. Any more ideas? -David

Anonymous's picture
Created by Anonymous
5 points

Increase the number of allowed mysql connection in your mysql configuration file. In your unix environment, it would /etc/my.cnf file that needs to be updated and the variable that needs to be changed is max_connections (this mysql variable is same for windows, linux or MAC).

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.