windows和linux安装mysql后启用日志管理功能的方法
时间:2024-01-16 07:39:14
查看是否启用了日志
mysql>show variables like 'log_bin';
怎样知道当前的日志
mysql> show master status;
展示二进制日志数目
mysql> show master logs;
看二进制日志文件用mysqlbinlog
shell>mysqlbinlog mail-bin.000001
或者
shell>mysqlbinlog mail-bin.000001 | tail
在配置文件中指定log的輸出位置.
Windows:Windows 的配置文件为 my.ini,一般在 MySQL 的安装目录下或者 c:\Windows 下。
Linux:Linux 的配置文件为 my.cnf ,一般在 /etc 下。
日志文件类型概述:
1.错误日志 记录启动、运行或停止mysqld时出现的问题。
My.ini配置信息:
#Enter a name for the error log file. Otherwise a default name will be used.
#log-error=d:/mysql_log_err.txt
2.查询日志 记录建立的客户端连接和执行的语句。
My.ini配置信息:
#Enter a name for the query log file. Otherwise a default name will be used.
#log=d:/mysql_log.txt
3.更新日志 记录更改数据的语句。不赞成使用该日志。
My.ini配置信息:
#Enter a name for the update log file. Otherwise a default name will be used.
#log-update=d:/mysql_log_update.txt
4.二进制日志 记录所有更改数据的语句。还用于复制。
My.ini配置信息:
#Enter a name for the binary log. Otherwise a default name will be used.
#log-bin=d:/mysql_log_bin
5.慢日志 记录所有执行时间超过long_query_time秒的所有查询或不使用索引的查询。
My.ini配置信息:
#Enter a name for the slow query log file. Otherwise a default name will be used.
#long_query_time =1
#log-slow-queries= d:/mysql_log_slow.txt
linux下:
在[mysqld] 中輸入
log-error=/usr/local/mysql/log/error.log
log=/usr/local/mysql/log/mysql.log
long_query_time=2
log-slow-queries= /usr/local/mysql/log/slowquery.log
windows下
在[mysqld] 中輸入
##启动日志
log="E:/wamp/MySql/mysql_log/mysql.log"
##错误日志
log-error="E:/wamp/MySql/mysql_log/mysql.logerror.log"
##是指执行超过多久的sql会被log下来,这里是2秒
long_query_time=2
##慢查询日志
log-slow-queries= "E:/wamp/MySql/mysql_log/slowquery.log"
long_query_time =2 --是指执行超过多久的sql会被log下来,这里是2秒
log-slow-queries= /usr/local/mysql/log/slowquery.log --将查询返回较慢的语句进行记录
log-queries-not-using-indexes = nouseindex.log --就是字面意思,log下来没有使用索引的query
log=mylog.log --对所有执行语句进行记录
标签:windows,linux,mysql,日志
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
ASP脚本变量、函数、过程和条件语句
2008-10-14 14:43:00
![](https://img.aspxhome.com/file/UploadPic/200812/2008121313306289.gif)
如何把Oracle 数据库从 RAC 集群迁移到单机环境
2024-01-28 06:29:05
Vue3状态管理之Pinia的入门使用教程
2024-05-09 15:12:03
python实现维吉尼亚加密法
2023-06-12 23:19:21
![](https://img.aspxhome.com/file/2023/7/59817_0s.jpg)
PHP中把stdClass Object转array的几个方法
2023-11-19 06:56:33
详解vue-amap引入高德JS API的原理
2024-06-05 09:19:31
![](https://img.aspxhome.com/file/2023/8/123048_0s.jpg)
python 实时遍历日志文件
2021-03-30 09:26:20
混乱的标记语言XHTML2/HTML5
2009-07-31 14:27:00
![](https://img.aspxhome.com/file/UploadPic/20097/31/200973114466783s.jpg)
MySQL Server层四个日志的实现
2024-01-21 11:16:58
![](https://img.aspxhome.com/file/2023/8/117838_0s.jpg)
python 高效去重复 支持GB级别大文件的示例代码
2022-06-18 09:39:48
JS严格模式知识点总结
2024-05-13 10:06:42
js 删除数组的几种方法小结
2024-04-22 22:42:37
解决Win10系统安装MySQL8.0遇到的问题
2024-01-19 12:55:27
![](https://img.aspxhome.com/file/2023/4/129944_0s.jpg)
php反序列化之魔术方法超详细讲解
2023-11-16 07:24:59
![](https://img.aspxhome.com/file/2023/1/55621_0s.png)
python用pyecharts画矩形树图实例
2022-12-20 21:42:04
![](https://img.aspxhome.com/file/2023/0/90310_0s.png)
Python中shutil模块的常用文件操作函数用法示例
2022-10-16 07:10:08
python 爬取壁纸网站的示例
2022-07-10 13:29:54
![](https://img.aspxhome.com/file/2023/8/87978_0s.png)
Python读取pdf表格写入excel的方法
2023-08-25 12:33:18
![](https://img.aspxhome.com/file/2023/3/62603_0s.png)
Mysql的Table doesn't exist问题及解决
2024-01-16 05:03:13
pandas 空数据处理方法详解
2022-08-18 00:29:01