Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to limit the number of concurrent connections to one MySQL database, regardless of which user is connecting to it?

share|improve this question
up vote 1 down vote accepted

No, this is not possible.
You can limit the connection one user can have or globally limit the overall connections one instance will accept.
You cannot limit connections to one specific database regardless of the user.

share|improve this answer

In /etc/my.cnf (by default) under the [mysqld] section, you can add/edit the following:

max_connections = 500 

This will allow 501 users to connect. 500 normal connections and 1 reserved connection for a super-user. This will limit the total number of connection to the whole mysql server.

If you want to limit the number of users that can use a single db, move it to a separate mysql-installation. This will give you some more overhead.

More info on how to do this, can be found here: mySQL Multiple Servers Documentation

share|improve this answer

"Set max_connections to the number of concurrent connections you need. The default value is only 100 connections, which is very small."

So, yes you can set "max_connections"

share|improve this answer

You can use the max_connections system variable. More information here.

After re-reading your question, it looks that you want to limit the number of connections to one specific database. Unfortunately this is not possible, but you can grant permissions to only one user to access this database and limit its connections - yes, it's just a workaround, but in my opinion it's the best option in your case. Here is more information how to limit user's resources.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.