MySQL记录所有执行的SQL语句

在MySQL配置文件my.ini中加入:

log-output=FILE
general_log=1
general_log_file="D:\\wamp64\\logs\\mysql_all_sql.log"

随后重启MySQL

在mysql_all_sql.log日志文件中可以看到如下日志:

wampmysqld64, Version: 5.7.36-log (MySQL Community Server (GPL)). started with:
TCP Port: 3306, Named Pipe: /tmp/mysql.sock
Time                 Id Command    Argument
2022-12-23T01:01:14.097167Z	    2 Connect	root@localhost on internet_hospital using TCP/IP
2022-12-23T01:01:14.099165Z	    2 Prepare	SHOW COLUMNS FROM `ihs_shop_goods`
2022-12-23T01:01:14.099261Z	    2 Execute	SHOW COLUMNS FROM `ihs_shop_goods`
2022-12-23T01:01:14.108519Z	    2 Close stmt	
2022-12-23T01:01:14.114459Z	    2 Prepare	SELECT `goods_id`,`goods_name`,`picture`,price as spu_price,promotion_price as spu_promotion_price,(select min(price) from ihs_shop_goods_sku where goods_id=isg.goods_id) as sku_price,(
                        select concat(isag.promote_price,'_',isa.act_type)
                        from ihs_shop_activity isa inner join ihs_shop_activity_goods isag
                        on isa.act_id = isag.act_id
                        where isag.goods_id =goods_id
                        order by isa.act_type desc limit 1
                    ) as act_promote FROM `ihs_shop_goods` `isg` WHERE  `category_id_1` = ?  AND `state` = ?  AND `is_delete` = ? ORDER BY  isg.create_time desc, isg.sales+isg.real_sales desc  LIMIT 0,6
2022-12-23T01:01:14.114772Z	    2 Execute	SELECT `goods_id`,`goods_name`,`picture`,price as spu_price,promotion_price as spu_promotion_price,(select min(price) from ihs_shop_goods_sku where goods_id=isg.goods_id) as sku_price,(
                        select concat(isag.promote_price,'_',isa.act_type)
                        from ihs_shop_activity isa inner join ihs_shop_activity_goods isag
                        on isa.act_id = isag.act_id
                        where isag.goods_id =goods_id
                        order by isa.act_type desc limit 1
                    ) as act_promote FROM `ihs_shop_goods` `isg` WHERE  `category_id_1` = 1123  AND `state` = 2  AND `is_delete` = 0 ORDER BY  isg.create_time desc, isg.sales+isg.real_sales desc  LIMIT 0,6
2022-12-23T01:01:14.117320Z	    2 Close stmt	
2022-12-23T01:01:14.117508Z	    2 Prepare	SELECT COUNT(*) AS tp_count FROM `ihs_shop_goods` WHERE  `category_id_1` = ?  AND `state` = ?  AND `is_delete` = ? LIMIT 1
2022-12-23T01:01:14.117777Z	    2 Execute	SELECT COUNT(*) AS tp_count FROM `ihs_shop_goods` WHERE  `category_id_1` = 1123  AND `state` = 2  AND `is_delete` = 0 LIMIT 1
2022-12-23T01:01:14.120878Z	    2 Close stmt	
2022-12-23T01:01:14.121424Z	    2 Quit	

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值