MySQL中的日志类型(二)-General query log

简介

General query log记录客户端的连接和断开,以及从客户端发来的每一个SQL语句。

日志内容格式

General query log可以记录在文件中,也可以记录在表中,格式如下:
在文件中会记录时间、线程ID、命令类型以及执行的语句
示例如下:
MySQL中的日志类型(二)-General query log
当日志记录在表中时,还会记录账号信息,示例如下:
MySQL中的日志类型(二)-General query log

记录时间

General Query Log在数据库接收到客户端发来的语句时进行记录。这意味着General Query Log的顺序可能和实际语句执行的顺序是不同的。

设置方法

General Query Log可以在数据库启动时开启,也可以在数据库运行时开启。
在数据库启动前:
设置--general_log来开启日志
设置--log_output=[FILE,TABLE,NONE]来确定日志存放的位置。
设置--general_log_file=file_name来确定日志文件的名称和目录。
在数据库运行时:
修改全局变量来修改日志设置
修改general_log、log_output、general_log_file的值来修改相关设置,例如:

SET GLOBAL general_log=1
SET GLOBAL log_output='FILE';

此外,可以通过设置sql_log_off的值为ON或OFF来禁用或启用当前连接的General query log。

其他

数据库会根据log_output的值将日志写入到文件或表中。
但是不论log_output的值为多少,当开启日志时(或者刷新日志文件时),都会在日志文件中写入一个启动的消息。启动信息示例如下:
MySQL中的日志类型(二)-General query log

转载于:https://blog.51cto.com/13540167/2058942

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278649.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

android wi-fi_如何在Android手机上查找3G或Wi-Fi速度

android wi-fiAre you curious about what kind of connection speed you are getting with your Android phone? Today we’ll take a look at how to easily check your Wi-Fi or 3G speeds with Speedtest.net’s Speed Test app. 您是否对Android手机的连接速度感到好奇&a…

vue引入全局less实现全局变量的控制

vue引入全局less1.设置全局样式变量的好处:2.以less为例(sass等同原理)1.vue-cli2搭建的项目(1)2.vue-cli2搭建的项目(2)3.vue-cli3、vue-cli43.vue-cli2和vue-cli3的区别4.vue-cli3和vue-cli4的…

如何在eclipse中对项目进行重新编译

有时由于eclipse异常关闭,当我们重启Eclipse,在启动项目时,会报错,说:ClassNotFound类似的错误,引起这种问题的原因可能是由于,Eclipse异常关闭引起的。 解决:在一个项目中&#xff…

SQL 查询数据库中包含指定字符串的相关表和相关记录

declare str varchar(100)set str我要找的 --要搜索的字符串declare s varchar(8000)declare tb cursor local forselect if exists(select 1 from [b.name] where [a.name] like %str%)print [b.name].[a.name]from syscolumns a join sysobjects b on a.idb.idwhere b.xtype…

如何在Gmail的图片中插入超链接

Adding hyperlinks is an efficient way of getting your reader to the intended web page. Though it’s no secret that you can add hyperlinks to text, Gmail also lets you add hyperlinks to images in the body of the email. Here’s how to make it happen. 添加超链…

内联元素居中

父元素&#xff1a; height:100px; line-height:100px; // 与高相同 text-align:center; 子元素: display:inline; vertical-align: middle; 适用图片、文字 <div><div class"wrapper"><span>我是文字</span></div><div class&qu…

防止html标签转义

function htmlDecode ( str ) {var ele document.createElement(span);ele.innerHTML str;return ele.textContent;} 例如body下边所有的p标签都防止转义&#xff1a; $.each($("body").find(p),function(){this.innerHTML htmlDecode(this.innerHTML);}); 转载于…

新垣结衣自拍照_如何阻止自拍照出现在iPhone的自拍照专辑中

新垣结衣自拍照Khamosh PathakKhamosh PathakThe Photos app on your iPhone automatically populates all photos from the front-facing camera in the Selfies album. But what if you don’t want a photo to appear there? Here are a couple of solutions. iPhone上的“…

前端个人笔记

前端个人笔记1.vue项目安装依赖/插件时忘记--save&#xff0c;再次install出问题并且没有报错。2.margin移动元素不显示背景色3.新知识&#xff1a;media 条件样式4.入坑&#xff1a;row和col不能分离&#xff0c;span24不能不写5.聚焦实现滚动到指定元素1.vue项目安装依赖/插件…

kernel中对文件的读写【学习笔记】【原创】

/*1. 头文件 */ #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/fs.h> #include <linux/uaccess.h>MODULE_PARM_DESC(iva…

ssm项目快速搭建(注解)-依赖

父层jar包版本控制&#xff0c;管理配置 <!-- 集中定义依赖版本号 --> <properties> <junit.version>4.12</junit.version> <spring.version>4.2.4.RELEASE</spring.version> <pagehelper.version>4.0.0<…

如何设置自定义任务栏图标_如何为任何应用程序自定义Windows 7任务栏图标

如何设置自定义任务栏图标Would you like to change out the icons on your taskbar with a beautiful set of icons that all go together? Here’s how you can change out the random candy-colored icons for a stylish icon set of your choice. 您是否要用一组漂亮的图…

给谷歌浏览器安装vue调试工具:vue-devtools

安装vue-devtools一、拉取项目二、install、build三、添加扩展四、使用举例一、拉取项目 vue-devtools&#xff1a;git地址&#xff08;master分支&#xff09; 非master分支在build的时候会报错。 二、install、build 1、打开cmd进入项目目录&#xff0c;可以选择npm/cnpm/…

如何找到Windows 7或8家庭组密码?

So you’re about to setup your new Windows 7 PC into your Homegroup when you realized that you have no idea what the password is. How do you find it? It’s actually pretty simple, if you know where to look. 因此&#xff0c;当您意识到自己不知道密码是什么时…

vue3.0、cli4项目引入element plus

element团队为新版的 vue-cli4 准备了相应的 Element Plus 插件 安装依赖 npm install element-plus --savemain.js全局引入&#xff0c;样式文件需要单独引入 import { createApp } from vue import ElementPlus from element-plus; import element-plus/lib/theme-chalk/in…

MySQL索引背后的数据结构及算法原理

title: MySQL索引背后的数据结构及算法原理 date: 2018-07-25 19:50:16 tags: mysql categories: mysql --- 本文转载自http://blog.codinglabs.org/articles/theory-of-mysql-index.html 摘要 本文以MySQL为研究对象&#xff0c;讨论与数据库索引相关的一些话题。特别需要说明…

[SDOI2015]约数个数和

Sol 首先有个结论\(\sum_{i1}^{m}\sum_{j1}^{n}d(i*j)\sum_{i1}^{m}\sum_{j1}^{n}\sum_{x|i}\sum_{y|i}[gcd(x,y)1]\) 证明&#xff1a;可以看po姐的博客 接着这个式子推\[ 原式\sum_{x1}^{n}\sum_{y1}^{m}([gcd(x, y)1] * \sum_{x|i}\sum_{y|i} 1)\\ \sum_{x1}^{n}\sum_{y1}^{…

使用mcBackup备份Windows 7 Media Center设置

If you’re a HTPC enthusiast and use Windows 7 Media Center, you probably have a lot of scheduled recordings and channel lineups you’d like to backup. Here we take a look at a simple tool that will allow you to do it easily. 如果您是HTPC爱好者并且使用Wind…

【CF961G】Partitions(第二类斯特林数)

【CF961G】Partitions&#xff08;第二类斯特林数&#xff09; 题面 CodeForces洛谷 题解 考虑每个数的贡献&#xff0c;显然每个数前面贡献的系数都是一样的。 枚举当前数所在的集合大小&#xff0c;所以前面的系数\(p\)就是&#xff1a;\[\begin{aligned} p&\sum_{i1}^n{…

js绑定事件和阻止事件

js事件一、绑定事件1、html绑定2、el属性绑定3、el函数绑定4、事件捕获与冒泡5、js常见事件称名二、阻止事件1、event.stopPropagation()2、return false3、event.preventDefault();4、兼容写法一、绑定事件 1、html绑定 <div onclick"alert(click!)">click&…