sql命令查看,清楚mysql bin日志

时间:2022-11-04 12:14:30
查看二进制日志文件
mysql> SHOW BINLOG EVENTS \G;
mysql> SHOW MASTER LOGS;
清除二进制日志文件
mysql> PURGE { MASTER|BINARY } LOGS TO 'log_name';
mysql> PURGE { MASTER|BINARY } LOGS BEFORE 'datetime';
例如:
mysql> PURGE MASTER LOGS TO 'mysql-bin.000001';
mysql> PURGE MASTER LOGS BEFORE '2009-12-20 13:00:00';
另一种清除二进制日志方法
mysql > flush logs;
mysql > reset master;