HOW TO INCREASE AND DECREASE MYSQL MAX_CONNECTION

STEP.1.Check connection in mysql database

mysql>  show variables like '%max_connection%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

Step.2.suppose you need 500 user at a time connect in mysql database then you need to increase the no of connection or max_connection variable.

There are two way to increase and decrease connection:-

1.Temporary
2.parmament.

1.you need to login mysql as root user and set max_connection variable.

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

Important thing you reboot the system your max_connection as well as previous state.

mysql>  show variables like '%max_connection%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)


2.you can increase parmament connection then you can entry in my.cnf file under mysqld section.

vi /etc/my.cnf
[mysqld]

max_connection = 500

then restart mysqld servervice

systemctl restart mysqld

step.3.after that  you can check mysql connection


mysql>  show variables like '%max_connection%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 500   |
+-----------------+-------+
1 row in set (0.00 sec)


Thank You.


Comments

Popular posts from this blog

MySQL Point in Time Recovery: How To Configure And How Does it Work?

MySQL Replication Switchover: Step-by-Step Guide

Mysql Commercial Mysqlbackup:How to take Differential or Incremental Backup and resotre using mysqlbackup utility in mysql 8.0.37 enterprise edition