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

相关推荐
J超会运9 小时前
OpenEuler系统MySQL故障排查终极指南
mysql
csdn_aspnet12 小时前
MySQL主从延迟根因诊断法,从网络、IO、SQL到参数,系统化定位高并发下的同步瓶颈
数据库·mysql·主从
Deryck_德瑞克13 小时前
【已解决】MySQL连接出错 1045 - Access denied for user ‘root‘@‘::1‘
android·mysql·adb
回到原点的码农14 小时前
Linux(CentOS)安装 MySQL
linux·mysql·centos
m0_4912670014 小时前
Docker部署MySQL 多库自动备份(结构+数据完整,适配CentOS)
mysql·安全
高梦轩14 小时前
MySQL 故障排查与优化
数据库·mysql
吴声子夜歌15 小时前
Node.js——操作MySQL数据库
数据库·mysql·node.js
爱丽_15 小时前
MySQL 锁等待与死锁进阶:怎么看等待、怎么降冲突(工程化套路)
数据库·mysql
心有—林夕15 小时前
MySQL 误操作恢复完全指南
android·数据库·mysql
夕除15 小时前
Mysql--15
java·数据库·mysql