在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