zoukankan      html  css  js  c++  java
  • mysql session相关命令

     

    MySQL session相关命令

    1. 查看MySQL最大连接数

      show variables like 'max_connections';
    2. 查看MySQL当前连接数

      show status like 'Threads_connected';
    3. 查看MySQL当前进程状态

      show processlist;  -- 总量与Threads_connected相同
    4. 修改MySQL最大连接数

      set global max_connections=4096;  -- 临时修改
    5. 手动杀死sleep的进程

      kill $id;  -- 杀死单个进程

      select concat('KILL ',id,'; -- ', Command, ' ', time) from information_schema.processlist where Command='Sleep' and time>1000;  -- 列出sleep时间超过1000s的进程,并用kill id的方式拼接

      select concat('KILL ',id,'; -- ', Command, ' ', time) from information_schema.processlist where Command='Sleep' and time>1000 into outfile '/tmp/kill.sql';  -- 将kill id的命令输出到/tmp/kill.sql文件

      source /tmp/kill.sql;  -- 执行文件/tmp/kill.sql中的命令
    6. 使用Maatkit工具集中提供的mk-kill命令进行批量kill

      # 杀掉超过60秒的sql
      mk-kill -busy-time 60 -kill
      # 如果你想先不杀,先看看有哪些sql运行超过60秒
      mk-kill -busy-time 60 -print
      # 如果你想杀掉,同时输出杀掉了哪些进程
      mk-kill -busy-time 60 -print –kill.
    7.  
  • 相关阅读:
    下标处理问题
    C++输入输出流
    gcc和gdb
    B2C、C2C电子商务分析
    转载:java 动态代理学习(Proxy,InvocationHandler)
    Java Web开发中路径问题小结
    64位操作系统IIS降为32 位版本运行处理
    SQL Server 2000/2005 数据库分页
    iBatis简单入门教程
    JAVA中的Class类
  • 原文地址:https://www.cnblogs.com/aaron-agu/p/13953778.html
Copyright © 2011-2022 走看看