How to set max_connections in MySQL Programmatically?

To set max_connections in MySQL programmatically, you can use SET command. The syntax is as follows −

SET GLOBAL max_connections=yourIntegerValue;

Let us implement the above query to set maximum connections. The query is as follows −

mysql> set global max_connections=1000;
Query OK, 0 rows affected (0.04 sec)

Check maximum connections are set or not, using the show variables command. The query is as follows.

mysql> show variables like 'max_connections';

The following is the output.

| Variable_name   | Value |
| max_connections | 1000  |
1 row in set (0.18 sec)