# MySQL hits Too many connections frequently

**URL:** https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793
**Category:** Percona Server for MySQL 8.0
**Created:** [January 5, 2022, 9:42am UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793 "2022-01-05T09:42:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kalyan\_Kumar\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kalyan_kumar_a/32/5509_2.png) [@Kalyan\_Kumar\_A](https://forums.percona.com/u/Kalyan_Kumar_A)
#### Post date: [January 5, 2022, 9:42am UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/1 "2022-01-05T09:42:12Z")

</div>

We are using the below version and enabled MySQLX plugin. We frequently seeing issues with this instance with “Too Many Connections” & Show status is getting hung and we were unable to access the instance and restart is the only solution during that time.

8.0.16-7 Percona Server (GPL), Release 7, Revision 613e312

We have modified Thread related parameters and open files limit but no luck

Any inputs related to this issue will be grateful

mysql\> show global variables like ‘%open%’;  
±---------------------------±------+  
| Variable\_name | Value |  
±---------------------------±------+  
| have\_openssl | YES |  
| innodb\_open\_files | 12112 |  
| mysqlx\_port\_open\_timeout | 0 |  
| open\_files\_limit | 90424 |  
| table\_open\_cache | 12112 |  
| table\_open\_cache\_instances | 16 |  
±---------------------------±------+

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [January 6, 2022, 3:14pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/2 "2022-01-06T15:14:44Z")

</div>

What is your `max_connections` variable set to? You may need to increase this parameter as this one directly affects how many simultaneous connections there can be.

---

<div class="post-metadata">

### Author: ![Kalyan\_Kumar\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kalyan_kumar_a/32/5509_2.png) [@Kalyan\_Kumar\_A](https://forums.percona.com/u/Kalyan_Kumar_A)
#### Post date: [January 7, 2022, 1:27pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/3 "2022-01-07T13:27:07Z")

</div>

Max connections is set to 1500, but as soon as it reaches 340+ connections I see too many connections error.

When I check like below the process ID of MySQL is occupied whole 1500 threads from OS side but they are not visible inside MySQL

ps -T 11105

11105 is a MySQL Process ID which I took from ps-ef | grep mysqld  
Its just showing below output for 1500 times

11105 12739 ? Sl 0:06 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [January 7, 2022, 3:05pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/4 "2022-01-07T15:05:25Z")

</div>

You will always see many more threads in MySQL as its model is different from other databases. There is not a 1:1 relationship between number threads and connections.

I would log into your mysql and run ‘show processlist’ every 1s and absolutely confirm that you never see more than 340 connections.

---

<div class="post-metadata">

### Author: ![Kalyan\_Kumar\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kalyan_kumar_a/32/5509_2.png) [@Kalyan\_Kumar\_A](https://forums.percona.com/u/Kalyan_Kumar_A)
#### Post date: [January 9, 2022, 7:35pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/5 "2022-01-09T19:35:38Z")

</div>

I have the script in please for every min and it doesn’t cross more than 350+ connections for sure

Regards  
Kalyan

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [January 10, 2022, 4:07pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/6 "2022-01-10T16:07:02Z")

</div>

I would remove the mysqlx plugin, unless you specifically need it (very rare) and I would also recommend you upgrade to the latest 8.0.\* version to see if a bug was fixed that is causing this issue.

---

<div class="post-metadata">

### Author: ![Kalyan\_Kumar\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kalyan_kumar_a/32/5509_2.png) [@Kalyan\_Kumar\_A](https://forums.percona.com/u/Kalyan_Kumar_A)
#### Post date: [January 10, 2022, 4:14pm UTC](https://forums.percona.com/t/mysql-hits-too-many-connections-frequently/13793/7 "2022-01-10T16:14:37Z")

</div>

MySQL X plugin is actively used by app teams. We will try to upgrade to latest version and update you

Thanks  
Kalyan
