By default MySQL maximum allowed number of simultaneous client connection set to 151.
Each connection is based on the availability of RAM space and memory usages. So you have to set that max_connection based on work load.
If you need to increase that max_connection its not a difficult to update.
There are two ways can be changed,
Before that, to check how many MySQL connections are open?
mysql> SHOW STATUS WHERE `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 153 |
+-------------------+-------+
1 row in set (0.00 sec)
or
mysql> show global status like '%thread%';
+------------------------------------------+-------+
| Variable_name | Value |
+------------------------------------------+-------+
| Delayed_insert_threads | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Slow_launch_threads | 0 |
| Threads_cached | 0 |
| Threads_connected | 153 |
| Threads_created | 382 |
| Threads_running | 1 |
+------------------------------------------+-------+
8 rows in set (0.00 sec)
Views maximum allowed number of simultaneous connections limit,
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)
Do you want to update maximum connection limit directly,
Mysql> SET GLOBAL max_connections = 200;
Check connection limit,
mysql> select @@global.max_connections;
or
mysql> show variables like "max_connections";
+--------------------------+
| @@global.max_connections |
+--------------------------+
| 250 |
+--------------------------+
1 row in set (0.00 sec)
Another option is update in my.cnf file and apply the line,
# vi my.cnf
max_connections = 250
max_connections = 250
Finally, restart MySQL once you have update or any changes and verify with the same command
mysql> show variables like "max_connections";
Comments (0)