Tuesday, May 19, 2020

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.


No comments:

Post a Comment

HOW TO TO CALCULATE TABLE SIZE IN MB AND CREATE EXCEL SHEET IN MYSQL 5.7 USING CENTOS 7

 HOW TO TO CALCULATE TABLE SIZE IN MB AND CREATE EXCEL SHEET IN MYSQL 5.7 USING CENTOS 7 1.Given command below:- SELECT       table_schema a...