Too many connections

Ours servers maintain performance by limiting user connections to 20, otherwise, users could open unlimted number of connections and overwhelm the server.

We find 20 connections is more than enough to run websites and applications.

The connection limit doesn’t directly relate to the number of people able to use a website or application.  A website can serve many pages whilst using a limited number of connections.  Although, if you have a VERY popular website or app, you may want to think about upgrading.

But sometimes you may see a ‘Too Many Connections’ error.  This is caused when you’ve reached the limit of the available connections.

When this occurs, we suggest looking closely at your MySQL connections to work out why the limit has been reached.

Common issues include slow queries that require a long time to run, which stop the connection from closing, stopping it from being used again.

You can see what connections you are using by running this query:

show processlist

or

show full processlist

https://dev.mysql.com/doc/refman/8.0/en/show-processlist.html

Pay attention to the ‘time’ and ‘state’.  If the query has been running for a long time, and the other connections are waiting, then you have a query holding up the processing of the other queries, so they are unable to close.

More information can be found here https://dev.mysql.com/doc/refman/8.0/en/too-many-connections.html