{

Fix for User already has more than max_user_connections active connections in MySQL database


This is a short tutorial on how to fix (42000/1203): User already has more than ‘max_user_connections’ active connections in the MySQL database server.

You will see an error that failed to connect to the database.

These errors are thrown from the client machine connecting to the database server.

In MySQL, there is a limit on the maximum number of simultaneous connections to the database server.

If maximum connections from the same user to the database are more than the defined database max_user_connections.

The solution is to increase max_user_connections at the database server.

MySQL has a system variable max_user_connections that can be configured at either startup or runtime.

First, check how many maximum user connections are allowed using the below command.

show global variables like '%connections%'

It outputs the following things

max_connections 4030
max_user_connections  0
reserved_super_connections  20

As per the above command, max_user_connections is zero which means there is no limit on the number of connections allowed.

if max_user_connections is non-zero value, increase it to some value.

How can you increase max_user_connections in MySQL?

There are multiple ways we can configure at startup or runtime.

  • startup to change maximum connections

Go to MySQL\Data\my.ini and update with the below values

max_user_connections = zero or give total connection you want

below are possible values A zero number means no limit on the number of connections a positive number is the maximum connections

  • Runtime to change maximum connections In the command line, You can set the global system variable value to zero or a positive number
SET GLOBAL max_user_connections = 0 or number;

Once you set with either startup or command line, You need to restart the server to take effect.

The above changes were made from the client machine or database server.

Conclusion

You learned how to solve maximum connections.

THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.