1、MySQLshow status like '%connect%';

Connections,试图连接到(不管是否成功)MySQL服务器的连接数。
   Max_used_connections,服务器启动后已经同时使用的连接的最大数量。
   Threads_connected,当前的连接数。

2、mysql> show variables like '%connect%';

max_connections,最大连接数。

3、修改max_connections

在配置文件(my.cnf或my.ini)在最下面,天加一句:
   max_connections=32000
   然后,用命令重启:/etc/init.d/mysqld restart
   虽然这里写的32000,实际MySQL服务器允许的最大连接数16384;
   添加了最大允许连接数,对系统消耗增加不大。

4、mysql> show processlist;
显示当前正在执行的MySQL连接。

mysql> show status like '%connect%';
+-----------------------------------------------+-------+
| Variable_name | Value |
+-----------------------------------------------+-------+
| Aborted_connects | 2 |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 445 |
| Max_used_connections | 61 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 57 |
+-----------------------------------------------+-------+
14 rows in set (0.00 sec) mysql> 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 | 151 |
| max_user_connections | 0 |
| performance_schema_session_connect_attrs_size | 512 |
+-----------------------------------------------+-----------------+
9 rows in set (0.00 sec) mysql> show processlist;
+-----+------+---------------------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+---------------------+------+---------+------+-------+------------------+
| 315 | srea | 192.168.0.206:58566 | srea | Sleep | 3370 | | NULL |
| 316 | srea | 192.168.0.206:58567 | srea | Sleep | 3370 | | NULL |
| 317 | srea | 192.168.0.206:58568 | srea | Sleep | 3370 | | NULL |
| 318 | srea | 192.168.0.206:58569 | srea | Sleep | 3370 | | NULL |
| 319 | srea | 192.168.0.206:58570 | srea | Sleep | 3370 | | NULL |
| 320 | srea | 192.168.0.206:58572 | srea | Sleep | 3370 | | NULL |
| 321 | srea | 192.168.0.206:58575 | srea | Sleep | 3370 | | NULL |
| 322 | srea | 192.168.0.206:58576 | srea | Sleep | 3370 | | NULL |
| 323 | srea | 192.168.0.206:58577 | srea | Sleep | 3370 | | NULL |
| 324 | srea | 192.168.0.206:58578 | srea | Sleep | 3370 | | NULL |
| 325 | srea | 192.168.0.206:58579 | srea | Sleep | 3370 | | NULL |
| 326 | srea | 192.168.0.206:58581 | srea | Sleep | 3370 | | NULL |
| 327 | srea | 192.168.0.206:58582 | srea | Sleep | 3370 | | NULL |
| 328 | srea | 192.168.0.206:58583 | srea | Sleep | 3370 | | NULL |
| 329 | srea | 192.168.0.206:58586 | srea | Sleep | 3370 | | NULL |
| 330 | srea | 192.168.0.206:58587 | srea | Sleep | 3370 | | NULL |
| 331 | srea | 192.168.0.206:58589 | srea | Sleep | 3370 | | NULL |
| 332 | srea | 192.168.0.206:58590 | srea | Sleep | 3370 | | NULL |
| 334 | srea | 192.168.0.206:59012 | srea | Sleep | 2920 | | NULL |
| 335 | srea | 192.168.0.206:59342 | srea | Sleep | 2487 | | NULL |
| 336 | srea | 192.168.0.206:59343 | srea | Sleep | 2545 | | NULL |
| 337 | srea | 192.168.0.206:59344 | srea | Sleep | 2545 | | NULL |
| 338 | srea | 192.168.0.206:59345 | srea | Sleep | 2545 | | NULL |
| 339 | srea | 192.168.0.206:59346 | srea | Sleep | 2545 | | NULL |
| 340 | srea | 192.168.0.206:59347 | srea | Sleep | 2545 | | NULL |
| 341 | srea | 192.168.0.206:59348 | srea | Sleep | 2545 | | NULL |
| 342 | srea | 192.168.0.206:59349 | srea | Sleep | 2544 | | NULL |
| 343 | srea | 192.168.0.206:59350 | srea | Sleep | 2544 | | NULL |
| 344 | srea | 192.168.0.206:59351 | srea | Sleep | 2544 | | NULL |
| 345 | srea | 192.168.0.206:59352 | srea | Sleep | 2544 | | NULL |
| 346 | srea | 192.168.0.206:59353 | srea | Sleep | 2544 | | NULL |
| 347 | srea | 192.168.0.206:59354 | srea | Sleep | 2544 | | NULL |
| 348 | srea | 192.168.0.206:59355 | srea | Sleep | 2544 | | NULL |
| 349 | srea | 192.168.0.206:59356 | srea | Sleep | 2544 | | NULL |
| 350 | srea | 192.168.0.206:59357 | srea | Sleep | 2544 | | NULL |
| 351 | srea | 192.168.0.206:59358 | srea | Sleep | 2544 | | NULL |
| 353 | srea | 192.168.0.206:59341 | srea | Sleep | 2503 | | NULL |
| 354 | srea | 192.168.0.206:59340 | srea | Sleep | 2486 | | NULL |
| 418 | srea | 192.168.0.206:52115 | srea | Sleep | 643 | | NULL |
| 419 | srea | 192.168.0.206:52140 | srea | Sleep | 717 | | NULL |
| 420 | srea | 192.168.0.206:52145 | srea | Sleep | 717 | | NULL |
| 421 | srea | 192.168.0.206:52148 | srea | Sleep | 717 | | NULL |
| 422 | srea | 192.168.0.206:52151 | srea | Sleep | 717 | | NULL |
| 423 | srea | 192.168.0.206:52154 | srea | Sleep | 717 | | NULL |
| 424 | srea | 192.168.0.206:52157 | srea | Sleep | 717 | | NULL |
| 425 | srea | 192.168.0.206:52159 | srea | Sleep | 716 | | NULL |
| 426 | srea | 192.168.0.206:52160 | srea | Sleep | 716 | | NULL |
| 427 | srea | 192.168.0.206:52161 | srea | Sleep | 716 | | NULL |
| 428 | srea | 192.168.0.206:52164 | srea | Sleep | 716 | | NULL |
| 429 | srea | 192.168.0.206:52167 | srea | Sleep | 716 | | NULL |
| 430 | srea | 192.168.0.206:52169 | srea | Sleep | 716 | | NULL |
| 431 | srea | 192.168.0.206:52172 | srea | Sleep | 716 | | NULL |
| 432 | srea | 192.168.0.206:52175 | srea | Sleep | 716 | | NULL |
| 433 | srea | 192.168.0.206:52179 | srea | Sleep | 716 | | NULL |
| 436 | srea | 192.168.0.206:52114 | srea | Sleep | 668 | | NULL |
| 437 | srea | 192.168.0.206:52112 | srea | Sleep | 641 | | NULL |
| 444 | root | localhost | NULL | Query | 0 | init | show processlist |
+-----+------+---------------------+------+---------+------+-------+------------------+
57 rows in set (0.00 sec)

  

MySQL,查看连接数和状态等的更多相关文章

  1. Mysql 查看连接数,状态,最大并发数

    MySQL: ERROR 1040: Too many connections”的异常情况,造成这种情况的一种原因是访问量过高,MySQL服务器抗不住,这个时候就要考虑增加从服务器分散读压力:另一种原 ...

  2. mysql查看连接数和状态,设置连接数和超时时间

    1.mysql> show status like '%connect%'; Connections,试图连接到(不管是否成功)MySQL服务器的连接数.   Max_used_connecti ...

  3. MySql状态查看方法 MySql如何查看连接数和状态?

    原文:MySql状态查看方法 MySql如何查看连接数和状态? 如果是root帐号,你能看到所有用户的当前连接.如果是其它普通帐号,只能看到自己占用的连接 怎么进入mysql命令行呢? mysql的安 ...

  4. Mysql 查看连接数,状态 最大并发数(赞)

    Mysql 查看连接数,状态 最大并发数(赞)   -- show variables like '%max_connections%'; 查看最大连接数 set global max_connect ...

  5. MySQL查看连接数

    MySQL查看连接数 1.查看部分连接数(数目较多时) show processlist; 2.查看所有连接数(数目较多时) show full processlist;

  6. mysql查看连接数排查问题

    #mysql查看连接数SHOW VARIABLES LIKE '%max_connections%'; # max_connections 最大连接数 SHOW VARIABLES LIKE '%co ...

  7. Mysql查看连接数相关信息

    MySQL查看连接数相关信息在 数据库:INFORMATION_SCHEMA 表:PROCESSLIST 表结构如下: mysql> desc PROCESSLIST; +---------+- ...

  8. MySQL如何查看连接数和状态

    查看连接数 命令:show processlist 如果要是root账号,能够看见当前所有用户的连接.如果是普通账号,只能看到自己占用的连接数.   show processlist只能是列出前100 ...

  9. Mysql 查看连接数,状态 最大并发数 && 怎么设置才合理

    show status like '%max_connections%'; ##mysql最大连接数 set global max_connections=1000 ##重新设置 show varia ...

  10. Mysql 查看连接数,状态 最大并发数

    show status like '%max_connections%'; ##mysql最大连接数set global max_connections=1000 ##重新设置show variabl ...

随机推荐

  1. Sword pcre库函数学习三

    14.pcre_get_substring_list 原型: #include <pcre.h> int pcre_get_substring_list(const char *subje ...

  2. mysql insert exists || mysql 判断数据是否存在

    情景如下: "今日前端忽然说句, 我需要做个判断, 不能重复收藏, 我犹如颈有寒冰不寒而栗, 于是思考我该怎么做?为什么她都思考到了我没有思考到这是我的工作啊" 思考后得到三种解决 ...

  3. WEB打印大全

    1.控制"纵打". 横打”和“页面的边距. (1)<script defer> function SetPrintSettings() {  // -- advance ...

  4. SpagoBI 教程 Lesson 1:Introduction and Installation

    SapgoBI Lesson 1: Introduction and Installation Downloading and installing SpagoBI. Download SpagoBI ...

  5. 第三百二十四节,web爬虫,scrapy模块介绍与使用

    第三百二十四节,web爬虫,scrapy模块介绍与使用 Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架. 其可以应用在数据挖掘,信息处理或存储历史数据等一系列的程序中.其最初是为了 ...

  6. 生成基于Maven的项目文档站点

    在Maven中,可以使用“mvn site”,为您的项目信息生成文档站点. mvn site 生成的网站是在项目的“target/site”文件夹中. mvn site 示例 请参见通过“mvn si ...

  7. 架构 : 三层架构、MVC、MVP、MVVM

    1. 三层架构   将整个业务应用划分为:界面层(User Interface layer, UIL).业务逻辑层(Business Logic Layer, BLL).数据访问层(Data acce ...

  8. Eclipse中创建Maven项目失败

    Eclipse中创建Maven项目报错:Unable to create project from archetype org.apache.maven.archetypes:maven-archet ...

  9. ASP.net MVC 文件下载的几种方法

      ASP.net MVC 文件下载的几种方法(欢迎讨论) 在ASP.net MVC 中有几种下载文件的方法前提:要下载的文件必须是在服务器目录中的,至于不在web项目server目录中的文件下载我不 ...

  10. Linq中string转int的方法

    Linq中string转int的方法   在做批量删除时,需把一串id值所对应的数据删除,调试出现问题: Linq语句中如果使用ToString()进行类型转换,编译时不会报错,但执行时会出现如下错误 ...