如何查看MySQL binlog日志

1、查看MySQL是否开启binlog日志

SQL:show variables like ‘%log_bin%’;

log_bin:on 是开启状态
在这里插入图片描述

若是OFF,则需要开启binlog日志。

开启方式:打开mysql配置文件my.cnf,在[mysqlId]下面增加

log-bin=mysql-bin

查看binlog日志

mysql> show binlog events ``in 'mysql-bin.000002'``;#查看指定binlog文件的内容 
mysql> show binary logs; #获取binlog文件列表 
mysql> show master status; #查看当前正在写入的binlog文件
mysql> show binary logs; #获取binlog文件列表 
mysql> flush logs;#刷新日志时,会生成新的binlog文件

若是执行SQL报错如下,则是权限不够。需要进行添加权限。

SQL 错误 [1227] [42000]: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-13 21:18:07       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-13 21:18:07       106 阅读
  3. 在Django里面运行非项目文件

    2024-05-13 21:18:07       87 阅读
  4. Python语言-面向对象

    2024-05-13 21:18:07       96 阅读

热门阅读

  1. js 脚本语言

    2024-05-13 21:18:07       24 阅读
  2. 代码随想录算法训练营第36期DAY23

    2024-05-13 21:18:07       26 阅读
  3. 接口安全设计之防篡改和防重放

    2024-05-13 21:18:07       32 阅读
  4. 后端返回文件流格式,前端vue 导出下载表格

    2024-05-13 21:18:07       36 阅读
  5. Harmony 添加library依赖库步骤

    2024-05-13 21:18:07       32 阅读
  6. Spring+Mybatis-plus 实现 Gauss DB数据库代码生成

    2024-05-13 21:18:07       28 阅读
  7. puppyteer

    2024-05-13 21:18:07       35 阅读
  8. 力扣:738. 单调递增的数字

    2024-05-13 21:18:07       39 阅读