How to increase MySQL connections(max_connections)?

shekhar picture shekhar · Mar 10, 2014 · Viewed 120.8k times · Source

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.

Answer

Abdul Manaf picture Abdul Manaf · Mar 10, 2014

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