檢視mysql資料庫連線數 併發數相關資訊

2021-08-19 03:08:28 字數 1600 閱讀 8556

1、檢視連線數

show status like 'threads%';

+-------------------+-------+

| variable_name | value |

+-------------------+-------+

| threads_cached | 58 |

| threads_connected | 57 | ###這個數值指的是開啟的連線數

| threads_created | 3676 |

| threads_running | 4 | ###這個數值指的是啟用的連線數,這個數值一般遠低於connected數值

+-------------------+-------+

threads_connected 跟show processlist結果相同,表示當前連線數。準確的來說,threads_running是代表當前併發數

2、查詢資料庫當前設定的最大連線數

show variables like '%max_connections%';

+-----------------+-------+

| variable_name | value |

+-----------------+-------+

| max_connections | 1000 |

+-----------------+-------+

3、查詢連線有關的引數

show variables like '%connect%';

+-----------------+-------+

| variable_name | value |

+-----------------+-------+

| character_set_connection | utf8|

| collation_connection | utf8_general_ci|

| connect_timeout |

10|| disconnect_on_expired_password|

on|| init_connect| |

| max_connect_errors |

100|

| max_connections |

400|

| max_user_connections | |

| performance_schema_session_connect_attrs_size|

512|

+-----------------+-------+

4、

show processlist;
5、設定最大連線數

set

global max_connections=400;

或:修改mysql配置檔案my.cnf,在[mysqld]段中新增或修改max_connections值:

檢視mysql資料庫連線數 併發數相關資訊

檢視mysql資料庫連線數 併發數相關資訊 2011 11 18 14 24 00 分類 linux mysql show status like threads variable name value threads cached 58 threads connected 57 這個數值指的是開啟...

檢視mysql資料庫連線數 併發數相關資訊

mysql show status like threads variable name value threads cached 58 threads connected 57 這個數值指的是開啟的連線數 threads created 3676 threads running 4 這個數值指的是...

檢視mysql資料庫連線數 併發數相關資訊

mysql show status like threads variable name value threads cached 58 threads connected 57 這個數值指的是開啟的連線數 threads created 3676 threads running 4 這個數值指的是...