Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase MySQL connections(max_connections)?

Every socket of MySQL Database will have defaults connections as 100 but I am looking for any way to increase the number of possible connections > 100 to a socket connection of MySQL Database.

like image 845
shekhar Avatar asked Mar 10 '14 10:03

shekhar


People also ask

How do I increase MySQL connection pool size?

Go to sudo /opt/lampp/etc/my. cnf/ Add max_connections = your value example max_connections = 5000.

How do I increase max connections in MySQL workbench?

There are two ways to increase MySQL connections. Here's the command to update max connections to 200 via MySQL command line tool without restart. mysql> set global max_connections = 200; The above command will increase max connections without restart but once the server is restarted, the changes will be gone.


2 Answers

If you need to increase MySQL Connections without MySQL restart do like below

mysql> show variables like 'max_connections'; +-----------------+-------+ | Variable_name   | Value | +-----------------+-------+ | max_connections | 100   | +-----------------+-------+ 1 row in set (0.00 sec)  mysql> SET GLOBAL max_connections = 150; Query OK, 0 rows affected (0.00 sec)  mysql> show variables like 'max_connections'; +-----------------+-------+ | Variable_name   | Value | +-----------------+-------+ | max_connections | 150   | +-----------------+-------+ 1 row in set (0.00 sec) 

These settings will change at MySQL Restart.


For permanent changes add below line in my.cnf and restart MySQL

max_connections = 150 
like image 106
Abdul Manaf Avatar answered Oct 07 '22 02:10

Abdul Manaf


From Increase MySQL connection limit:-

MySQL’s default configuration sets the maximum simultaneous connections to 100. If you need to increase it, you can do it fairly easily:

For MySQL 3.x:

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

For MySQL 4.x and 5.x:

# vi /etc/my.cnf max_connections = 250 

Restart MySQL once you’ve made the changes and verify with:

echo "show variables like 'max_connections';" | mysql 

EDIT:-(From comments)

The maximum concurrent connection can be maximum range: 4,294,967,295. Check MYSQL docs

like image 38
Rahul Tripathi Avatar answered Oct 07 '22 01:10

Rahul Tripathi