0


如何查看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

标签: mysql

本文转载自: https://blog.csdn.net/qq_36010886/article/details/138794848
版权归原作者 静看º一季花开花落 所有, 如有侵权,请联系我们删除。

“如何查看MySQL binlog日志”的评论:

还没有评论