Increase MySQL maximum connection limit

MySQL’s default configuration sets the maximum concurrent connections to 151. If you get a too many connections error when you are trying to connect to MySQL server, this means that all available connections are in use by other clients / Users.

The number of connections permitted is controlled by the max_connections system variable. Its default value is 151, although you can it can accept a max of 152 connection (1 Connection reserved for Super User).  If you need to support more connections, you can set a larger value for this .

MySQL 3.x:

# vi /etc/my.cnf
set-variable = max_connections = 170

MySQL 4.x and 5.x:

# vi /etc/my.cnf
max_connections = 170

Restart MySQL once you’ve made the changes.

 /etc/init.d/mysqld restart 

or

 service mysqld restart 

You can also change this variable after logging into mysql server as a root user.

max conn var change
change max connections limit from mysql terminal

Find the existing limit :

show variables like ‘max_connections’;

Set the updated maximum connection limit :

SET GLOBAL max_connections = 170;

One thought on “Increase MySQL maximum connection limit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s