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

相关推荐
idolao5 小时前
MySQL 5.7 安装教程:详细步骤+自定义安装+命令行客户端配置(Windows版)
数据库·windows·mysql
20年编程老鸟java+ai全栈5 小时前
mysql、pg、oracel数据库迁移避坑指南
数据库·mysql
西柚0016 小时前
Ubuntu22.04.5 + Docker + MySQL 5.7
mysql·docker·容器
Yvonne爱编码7 小时前
数据库---Day 1 数据库基础
数据库·mysql·oracle
FL4m3Y4n7 小时前
MySQL索引原理与SQL优化
android·sql·mysql
guslegend7 小时前
MySQL高手第三章
数据库·mysql
spring2997927 小时前
MySQL无法连接到本地localhost的解决办法2024.11.8
数据库·mysql·adb
L1624767 小时前
MySQL 8.0 MGR + KeepAlived 生产级全流程搭建手册
数据库·mysql
spencer_tseng9 小时前
java.sql.SQLException: Unknown system variable ‘query_cache_size‘
mysql
吾诺9 小时前
mysql用户名怎么看
数据库·mysql