mysqlbinlog日志管理
匿名 · 更新于 2021/12/10
show variables like 'log_bin'; #查看是否开启binlog日志(如果显示OFF则代表未开启。在MySQL8以前,这个功能是默认关闭的,需要手动开启。)
show variables like 'binlog_format' #查看binlog日志格式
show binary logs; #获取binlog文件列表
show binlog events; #只查看第一个binlog文件的内容
show binlog events in 'mysql-bin.000002'; #查看指定binlog文件的内容
show master status; #查看当前正在写入的binlog文件
purge master logs before '2023-09-01 17:20:00' #删除指定日期之前的日志
flush logs #刷新生成新日志
