如何查看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 复制代码
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

相关推荐
源来猿往16 分钟前
mysql转postgresql【平移】
数据库·mysql·postgresql
Dream of maid22 分钟前
Mysql(7)子查询
android·数据库·mysql
农村小镇哥1 小时前
PHP递归遍历+MYSQL介绍+MYSQL基本操作
开发语言·mysql·php
赵渝强老师1 小时前
【赵渝强老师】MySQL数据库的分库与分表
数据库·mysql
·云扬·2 小时前
MySQL分区实战指南:从原理到落地的完整攻略
数据库·mysql
Trouvaille ~2 小时前
【MySQL篇】复合查询:多表数据的整合
数据库·sql·mysql·面试·复合查询·基础入门·多表连接
bukeyiwanshui2 小时前
20260414 正则表达式及shell三剑客
数据库·mysql·正则表达式
Trouvaille ~3 小时前
【MySQL篇】内外连接:多表关联的完整指南
android·数据库·mysql·面试·后端开发·dql·内外连接
geovindu3 小时前
go: Model,Interface,DAL ,Factory,BLL using mysql
开发语言·mysql·设计模式·golang·软件构建
梦想与想象-广州大智汇3 小时前
MySQL 同步数据到 ClickHouse 方案对比分析
数据库·mysql·clickhouse