• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS / mysql max connections limit check increase how to decide thread cache size

mysql max connections limit check increase how to decide thread cache size

Table of Contents

Toggle
  • mysql max connections limit check query commanding
  • mysql connection limit allowed
  • To view max Reached Mysql Connections since the Server start
  • To check active connections in mysql concurrent
  • to list all connections
  • mysql max connections recommended settings (how to choose)
  • mysql max connections calculator
    • Update max connection limit in mysql.conf
  • Check max used connections by mysql previous
    • Aborted connection mysql
  • Show threads currently running on MySQL DB instance
  • increasing thread_cache_size to allow more simultaneous users
  • aws rds mysql max connections
  • mysql too many connections fix

mysql max connections limit check query commanding

 

 

mysql connection limit allowed

mysql -u root -p

Password:

mysql> SHOW VARIABLES LIKE “max_connections”;

SHOW VARIABLES LIKE “max_connections”;

+—————–+——-+
| Variable_name | Value |
+—————–+——-+
| max_connections | 151 | default
+—————–+——-+
1 row in set (0.01 sec)

 

To view max Reached Mysql Connections since the Server start

SHOW GLOBAL STATUS LIKE ‘max_use%’;

+—————————+———————+
| Variable_name | Value |
+—————————+———————+
| Max_used_connections | 38 |
| Max_used_connections_time | 2021-06-08 02:39:27 |
+—————————+———————+

mysql> SHOW STATUS WHERE `variable_name` = ‘Max_used_connections’;
+———————-+——-+
| Variable_name | Value |
+———————-+——-+
| Max_used_connections | 107 |
+———————-+——-+
1 row in set (0.00 sec)

I don’t need to worry right now because 60+live visitors handled by page cache plugins.

 

To check active connections in mysql concurrent

SHOW STATUS WHERE `variable_name` = ‘Threads_connected’;

 

Mysql threads variable settings ideal

to list all connections

show status like ‘%onn%’;

mysql max connections recommended settings (how to choose)

 

In digital ocean manged sql limits

 

Plan Size mysql max connections OS Reserved
1 GB RAM 75 250MB
2 GB RAM 150 350MB
4 GB RAM 225 350MB
8 GB RAM 525
16 GB RAM 1,050
32 GB RAM 2,175
64 GB RAM 4,425

350 MB used Operating system.

750MB = 100MB per connection

4GB RAM Mysql dedicated machine 3.6GB usable and 3Gb*75=225

mysql max connections formula

 

mysql max connections calculator

max_connections = (Available RAM – Global Buffers) / Thread Buffers
available ram =MySQL ram
Global buffers
SHOW VARIABLES LIKE ‘%buffer%’;
innodb_buffer_pool, key_buffer_size, query_cache_size, etc
Available RAM = Global Buffers + (Thread Buffers x max_connections)
max_connections = (Available RAM – Global Buffers) / Thread Buffers
global buffers
innodb_buffer_pool_size
innodb_log_buffer_size
innodb_additional_mem_pool
net_buffer_length
total size of global buffers
thread buffers
sort_buffer_size
myisam_sort_buffer_size
read_buffer_size
join_buffer_size
read_mid_buffer_size
total threaded buffer size
generally 10% global buffers 1gb vs 100Mb.
max connections 151 default.
Ram= 1000+ (100*151)
1000+15100
1010+(112*27)
3024+1010=4GB.
otherway
check previous max used connections
increase
check mysql error logs.

Update max connection limit in mysql.conf

my.cnf
max_connections = 500
mysql> SHOW VARIABLES LIKE “max_connections”;
+—————–+——-+
| Variable_name | Value |
+—————–+——-+
| max_connections | 151 |
+—————–+——-+
1 row in set (0.03 sec)

Check max used connections by mysql previous

maximum number of connections that have been in use simultaneously since the server started.

 

mysql> SHOW GLOBAL STATUS LIKE ‘max_use%’;
+—————————+———————+
| Variable_name | Value |
+—————————+———————+
| Max_used_connections | 26 |
| Max_used_connections_time | 2021-02-12 02:39:15 |
+—————————+———————+
2 rows in set (0.02 sec)
Variable_name | Value |
+————————+——-+
| max_connections | 151 |
| mysqlx_max_connections | 100 |
+————————+——-+
he maximum number of concurrent client connections X Plugin can accept. This is the X Plugin equivalent of max_connections;
mysql> SHOW GLOBAL VARIABLES LIKE ‘max_user_connections’;
+———————-+——-+
| Variable_name | Value |
+———————-+——-+
| max_user_connections | 0 |
+———————-+——-+
1 row in set (0.00 sec)

Aborted connection mysql

mysql> show global status like “%Aborted%”;
+————————+——-+
| Variable_name | Value |
+————————+——-+
| Aborted_clients | 0 |
| Aborted_connects | 47073 |
| Mysqlx_aborted_clients | 0 |
+————————+——-+
3 rows in set (0.00 sec)

MySQL max connections formula

https://journeyontux.files.wordpress.com/2011/12/max_connection_measurements.xls

 

mysql> SHOW STATUS LIKE ‘Threads_connected’;
+——————-+——-+
| Variable_name | Value |
+——————-+——-+
| Threads_connected | 1 |
+——————-+——-+
1 row in set (0.00 sec)

also follow mysql memory allocation & optimization

 

Show threads currently running on MySQL DB instance

SHOW FULL PROCESSLIST\G

 

increasing thread_cache_size to allow more simultaneous users

max_used_connections is 151, and your current value for thread_cache_size is 10,

then you have a problem

thread_cache_size should be greater than Max_used_connections.

SHOW GLOBAL STATUS LIKE ‘Connections’;
SHOW GLOBAL STATUS LIKE ‘Threads_created’;
SHOW GLOBAL STATUS LIKE ‘Max_used_connections’;

 

Threads_created / Connections : If this is over 0.01, then increase

4/427=0.001

+—————+——-+
| Variable_name | Value |
+—————+——-+
| Connections | 427 |
+—————+——-+
1 row in set (0.01 sec)

mysql> SHOW GLOBAL STATUS LIKE ‘Threads_created’;
+—————–+——-+
| Variable_name | Value |
+—————–+——-+
| Threads_created | 4 |
+—————–+——-+
1 row in set (0.00 sec)

mysql> SHOW GLOBAL STATUS LIKE ‘Max_used_connections’;
+———————-+——-+
| Variable_name | Value |
+———————-+——-+
| Max_used_connections | 4 |
+———————-+——-+
1 row in set (0.00 sec)

default mysql thread cache size is = 9 or 10

max connecton limit 151

Max_used_connectionsprevipous restrt 47

so i set thread cache size to 50

show global variables like ‘innodb_buffer_pool_size’;

thread_cache_size | 9

set global thread_cache_size = 50;

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

my.cnf

thread_cache_size = 50;

aws rds mysql max connections

Name Default Adjustable
Data API HTTP request body size 4 Megabytes No
Data API maximum concurrent cluster-secret pairs 30 No
Data API maximum concurrent requests 500 No
Data API maximum result set size 1 Megabytes No
Data API requests per second 1,000 No

 

mysql too many connections fix

ERROR 1040(): Too many connections error in the MySQL error log.

when it appears you need to increase the mysql max connections per second. it needs extra memory like memory per connection. more at amz rds

 

Primary Sidebar

MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS

  • mysqldump import /export mysql database command line, phpmyadmin, Cpanel, mysql workbench, xamp
  • mysql commands
  • phpmyadmin install / configure on nginx ubuntu 20.04 apache2 debian 10
  • improve mysql performance wordpress my.cnf file configuration
  • innodb buffer pool size measure & adjust by pages, read requests etc
  • mysql workbench tutorials (Sql Development , modelling, server admin export & import)
  • mysql errors
  • Innodb vs myisam (table engines row lock vs table lock)
  • mysql max connections limit check increase how to decide thread cache size
  • MySQL innodb memory allocation & usage calculation
  • MySQL query cache vs redis vs memcached buffer pool database cache
  • mysql 8 installation on ubuntu 20.4
  • mysql configuration file location linux , windows , mac
  • mysql root password change reset update set A-Z info
  • mysql user creation, password , grant permissions user management guide
  • mysql slow query log enable disable set query time ideal mysql long query time
  • mysql access denied for user 'root'@'localhost' (using password yes) no Error 1045
  • monitoring mysql with new relic
  • mysql restart ubuntu status start stop in linux windows reload
  • mysql open_files_limit increase to raise open file cache table definition cache
  • mysql memory limit setting increase or decrease allocation
  • mysqltuner installation suggestions
  • mysql auto backup ubuntu 22.04 using automysqlbackup
  • mysql high cpu usage cases and limiting cpu usage
  • mysql oom killer
  • mysql memory parameters
  • check mysql database size and table size
  • mysql find replace wordpress posts content
  • mysql import export database command line linux ubuntu debian wamp xamp
  • mysql interview questions and answers fresher to experience

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy