Question

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

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!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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