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 year 51 weeks ago
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.
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.
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
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).