首页 > 数据库 >查看sql语句执行日志

查看sql语句执行日志

时间:2022-09-07 10:01:34浏览次数:95  
标签:语句 set log sql +---+ general sec mysql 日志

mysql> show variables like "%general_log%";
+------------------+-------------------------+
| Variable_name    | Value                   |
+------------------+-------------------------+
| general_log      | OFF                     |
| general_log_file | /data/mysql/mysql01.log |
+------------------+-------------------------+
2 rows in set (0.01 sec)

mysql> set global general_log=on;
Query OK, 0 rows affected (0.01 sec)

mysql> select 1 from dual;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql> show variables like "%general_log%";
+------------------+-------------------------+
| Variable_name    | Value                   |
+------------------+-------------------------+
| general_log      | ON                      |
| general_log_file | /data/mysql/mysql01.log |
+------------------+-------------------------+
2 rows in set (0.00 sec)

mysql> set global general_log= off;
Query OK, 0 rows affected (0.01 sec)

mysql>  select 1 from dual;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec) 

查看日志

[root@mysql01 ~]# tail -20f /data/mysql/mysql01.log
/u01/mysql/bin/mysqld, Version: 5.7.35-log (MySQL Community Server (GPL)). started with:
Tcp port: 3306  Unix socket: /data/mysql/mysql.sock
Time                 Id Command    Argument
2022-09-07T01:47:35.996451Z	    2 Query	select 1 from dual
2022-09-07T01:47:51.109988Z	    2 Query	show variables like "%general_log%"
2022-09-07T01:48:09.323441Z	    2 Query	set global general_log= off

  

标签:语句,set,log,sql,+---+,general,sec,mysql,日志
From: https://www.cnblogs.com/omsql/p/16664262.html

相关文章

  • sql server 字符串分割成列表
    /*功能:分割字符示例:select*fromsplit('aa,bb,cc,dd',',')*/CREATEFUNCTION[dbo].[split](@StringVARCHAR(MAX),--字符串@DelimiterVARCHAR(MAX)--......
  • mybatisplus SQL一对多
    https://blog.csdn.net/Isyoubao/article/details/122212113 重点:<collectionproperty=“nspSchedulings”…/>property=“value”:对应list集合字段,当前为医生排班......
  • MySQL 大表优化方案,收藏了细看
    当MySQL单表记录数过大时,增删改查性能都会急剧下降,可以参考以下步骤来优化:单表优化除非单表数据未来会一直不断上涨,否则不要一开始就考虑拆分,拆分会带来逻辑、部署、运......
  • SQL Server如何在日期里提取年份和月份
    SQLServer如何在日期里提取年份和月份SQLServer中有获取年份和月份的函数YEAR和MONTH。话不多说,上例子,SELECTGETDATE()date,YEAR(GETDATE())asyear,MONTH(GET......
  • SQL的ROUND
    SELECTROUND(column_name,decimals)--selectCOUNT(gender),round(avg(gpa),1)FROMtable_name参数描述column_name必需。要舍入的字段。decimals必需。规定......
  • zabbix自定义监控进程与日志
    zabbix自定义监控进程与日志目录zabbix自定义监控进程与日志zabbix自定义监控进程zabbix自定义监控日志zabbix自定义监控进程基于之前的邮箱告警,部署完成后,我们在zabbi......
  • MySQL5.7完整安装教程及相关问题解决
    1 下载安装1.1下载直接官网下载https://www.mysql.com/①拉倒最下面,点community server②选择之前的版本③选5.7,通过压缩包来安装,点download1.2解压安装①下......
  • MYSQL数据库基础一
    MySQL基础MYSQL发展历史:1996年发布mysql1.0,命令来自他的大女儿名字的缩写。2008年Mysql被sun公司收购,2009年Oracle收购sun,因为Oracle有自己家的数据库,所以MySQL......
  • SQLI-LABS(Less-7)
    Less-7(GET-Dumpintooutfile-String)打开Less-7页面,可以看到页面中间有一句PleaseinputtheIDasparameterwithnumericvalue,那么先使用ID这个参数通过GET方式传入......
  • zabbix自定义监控进程和日志
    zabbix自定义监控进程和日志目录zabbix自定义监控进程和日志自定义监控进程配置监控脚本添加监控项添加触发器手动关闭httpd服务,触发报警自定义监控日志服务端和客户端操......