My situation is not exactly related to OP, but first result on google for my problem, so...
I was getting the too many connections
error in django as well. I have two servers deployed on AWS, one EC2 t2.micro (web server) and one RDS t2.micro (mysql database). The web server is running debian, with apt-get installs for apache2 (2.4.10-10+deb8u3), python (2.7.9), and django (1.7.7-1+deb8u3). I'm using django just for the ORM and website is hosted on apache using mod_wsgi.
mysql:
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 66 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.6.23 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.23-log |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+------------------------------+
7 rows in set (0.02 sec)
I had to tune down some settings in the /etc/apache2/sites-enabled/000-default.conf
to fix the too many connections error. These four settings were previously not in the config file (default values):
ServerLimit 2
MaxRequestWorkers 10
ThreadsPerChild 5
WSGIDaemonProcess aaa threads=6
<VirtualHost *:80>
....
mysql processlist (SELECT count(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user='www-user'
) now stays around 21.