Question

What file do I modify to increase my MYSQL max connections?

Posted December 14, 2019 4.1k views
MySQL

My db is giving a “too many connections” error so I need to increase the max number of connections. What (and what path) is the file that I need to modify?

I have searched the topics and submitted a support ticket… but nothing.

This is an excerpt of my error log:
2019/12/13 20:13:02 [error] [exception.CDbException] SQLSTATE[HY000] [2006] MySQL server has gone away
2019/12/13 20:13:02 [error] [application] CDbConnection failed to open the DB connection.
2019/12/13 20:13:02 [error] [exception.CDbException] SQLSTATE[HY000] [1040] Too many connections

Thank you!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @mxmxmktg,

There are a bunch of different reasons for the “Too Many Connections” error.

Check out this FAQ page on MySQL.com: http://dev.mysql.com/doc/refman/5.7/en/too-many-connections.html

Check your /etc/my.cnf file for “max_connections”. If none exist try:

[mysqld]
set-variable=max_connections=250

However the default is 151, so you should be okay.

Other problems to look out for is the use of persistent connections and running out of diskspace.

Regards,
KDSys