mysql查看正在执行的sql语句

2015年08月21日 17:32:59 阅读数:15398
 

有2个方法:

1、使用processlist,但是有个弊端,就是只能查看正在执行的sql语句,对应历史记录,查看不到。好处是不用设置,不会保存。

-- use information_schema;
-- show processlist;
或者:
-- select * from information_schema.`PROCESSLIST` where info is not null;
  • 1
  • 2
  • 3
  • 4

2、开启日志模式

-- 1、设置
-- SET GLOBAL log_output = 'TABLE'; SET GLOBAL general_log = 'ON';
-- SET GLOBAL log_output = 'TABLE'; SET GLOBAL general_log = 'OFF'; -- 2、查询
SELECT * from mysql.general_log ORDER BY event_time DESC -- 3、清空表(delete对于这个表,不允许使用,只能用truncate)
-- truncate table mysql.general_log;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

两种方式:mysql查看正在执行的sql语句的更多相关文章

  1. mysql查看正在执行的sql语句

    有2个方法: 1.使用processlist,但是有个弊端,就是只能查看正在执行的sql语句,对应历史记录,查看不到.好处是不用设置,不会保存. -- use information_schema; ...

  2. 并发编程 - 进程 - 1.开启子进程的两种方式/2.查看pid/3.Process对象的其他属性或方法/4.守护进程

    1.开启子进程的两种方式: # 方式1: from multiprocessing import Process import time def task(name): print('%s is ru ...

  3. MySql使用show processlist查看正在执行的Sql语句

    今天上班例行的查看了下服务器的运行状况,发现服务器特卡,是mysqld这个进程占用CPU到了99%导致的. 比较好奇是那个程序在使用mysql导致cpu这么高的,通过show processlist命 ...

  4. MySQL查看正在执行的SQL进程

    查看正在执行的SQL进程: show processlist; 查出来之后, 可以使用下面的命令终止SQL进程: kill ${进程ID}

  5. Mysql查看优化后的SQL 语句

    EXPLAIN  EXTENDED 1先执行 EXPLAIN  EXTENDED 2 show warnings: EXPLAIN EXTENDED SELECT * FROM `receivable ...

  6. UIIimageView读取图片的两种方式及动画的执行

    /**count:图片数量 name:图片名称*/ - (void)runAnimationWithCount:(int)count name:(NSString *)name { if(self.t ...

  7. 【转】mysql如何跟踪执行的sql语句

    转自http://blog.csdn.net/testcs_dn/article/details/18791815 在SQL SERVER下跟踪sql采用事件探查器,而在mysql下如何跟踪sql呢? ...

  8. mysql function动态执行不同sql语句

    create procedure cps() begin ) default 'user'; set strSql = concat('select * from ',table_user); pre ...

  9. Mysql查看锁等信息SQL语句

    查看锁等信息,包括锁信息: select "HOLD:",ph.id h_processid,trh.trx_id h_trx_id,trh.trx_started h_start ...

随机推荐

  1. 【转载】 强化学习(五)用时序差分法(TD)求解

    原文地址: https://www.cnblogs.com/pinard/p/9529828.html ------------------------------------------------ ...

  2. jQuery .each()方法与.data()方法

    .each(callback): 每次执行传递进来的函数时,函数中的this关键字都指向一个不同的DOM元素(每次都是一个不同的匹配元素).而且,在每次执行函数时,都会给函数传递一个表示作为执行环境的 ...

  3. [LeetCode&Python] Problem 690. Employee Importance

    You are given a data structure of employee information, which includes the employee's unique id, his ...

  4. [LeetCode&Python] Problem 784. Letter Case Permutation

    Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...

  5. tomcat:利用tomcat部署war包格式的项目

    配置jdk环境变量, 配置TOMCAT_HOME 变量, 将war包放入webapps中. 运行tomcar-bin文件夹中的startup.bat. tomcat会自动解压war包. 进入项目:

  6. day 016 面向对象---类与类的关系

    ---恢复内容开始--- 一  依赖关系(最轻的一种关系,在方法中引入另一个类的对象) class Elephant: def __init__(self,name): self.name=name ...

  7. python day 09 文件操作

    一 初识文件操作 使⽤用python来读写⽂文件是非常简单的操作. 我们使⽤用open()函数来打开⼀一个⽂文件, 获取到⽂文件句句柄. 然后通过⽂文件句句柄就可以进⾏行行各种各样的操作了了. 根据打 ...

  8. LeetCode - Rotate String

    We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost ...

  9. 统计cpu相关信息

    我的cpu为i3310m 适用类型:笔记本 CPU系列:酷睿i3 3代系列 CPU主频:2.4GHz 三级缓存:3MB 插槽类型:FCBGA1023,FCPGA988 封装大小:37.5×37.5mm ...

  10. 利用反射--调用一个按钮的Click事件

    最基本的调用方法 (1)button1.PerformClick();(2)button1_Click(null,null);(3)button_Click(null,new EventArgs()) ...