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.pswp.cn/news/278649.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278649.shtml
英文地址,請注明出處:http://en.pswp.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&…