博客
关于我
Linux MySQL日志——Error Log & Binary Log & Slow Query Log
阅读量:498 次
发布时间:2019-03-07

本文共 741 字,大约阅读时间需要 2 分钟。

MySQL日志

在这里插入图片描述

1 错误日志 :启动,停止,关闭失败报错。rpm安装日志位置 /var/log/mysqld.log

2 通用查询日志:所有的查询都记下来。
3 二进制日志:实现备份,增量备份。只记录改变数据,除了select都记。
4 中继日志:读取主服务器的binlog,在本地回放。保持一致。
5 slow log:慢查询日志,指导调优,定义某一个查询语句,定义超时时间,通过日志提供调优建议给开发人员。
6 DDL log: 定义语句的日志。

  • Error Log
vim /etc/my.cnf                进入主配置文件,观察日志是否启动。log-error=/var/log/mysqld.log  是否启动日志,日志位置。
  • Binary Log 默认没有开启二进制日志
vim /etc/my.cnf  log_bin           添加该字段,启动二进制日志  server-id=2       群集问题,必须指定该主机的序号。数字随意ls /var/lib/mysql/*bin*     查询二进制文件是否生成mysqlbinlog -v /var/lib/mysql/localhost-bin.000001
  • Slow Query Log 默认慢查询日志未开启
vim /etc/my.cnf  slow_query_log=1    启动慢查询日志  long_query_time=3   当SQL语句执行时间超过3s时,就会被记录到日志中  systemctl  restart  mysqld    重启数据库ll /var/lib/mysql/*slow*      查看日志文件是否生成localhost-slow.log

转载地址:http://quwjz.baihongyu.com/

你可能感兴趣的文章
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>
vue3+Ts 项目打包时报错 ‘reactive‘is declared but its value is never read.及解决方法
查看>>
Node-RED中Switch开关和Dropdown选择组件的使用
查看>>
Node-RED中使用html节点爬取HTML网页资料之爬取Node-RED的最新版本
查看>>
Node-RED中使用JSON数据建立web网站
查看>>
Node-RED中使用json节点解析JSON数据
查看>>