1,查看二进制日志
show master logs;
2,删除二进制日志
mysql> purge master logs to 'mysql-bin.000009';
Query OK, 0 rows affected (0.01 sec)
删除09以前的日志
mysql> purge master logs before '2018-09-04';
Query OK, 0 rows affected (0.01 sec)
删除9月4号之前的日志
还可以把expire_logs_days = 10 设置短也可以删除mysqlbinlog
mysql> reset master;
Query OK, 0 rows affected (0.01 sec)
删除所有mysqlbinlog
**3,查看mysqlbinlog里面的内容
**
mysqlbinlog --no-defaults /var/lib/mysql/mysql-bin.000002
show binlog events in 'mysql-bin.000003';
4,导出binlog日志
4.1 按照时间导出mysqlbinlog
mysqlbinlog --no-defaults --start-datetime='2018-09-27 10:39:00' --stop-datetime='2018-09-27 10:42:00' -d zabbix /var/lib/mysql/mysql-bin.00000*>/home/0927.sql
4.2 按照位置导出
mysqlbinlog --no-defaults --start-position=4 --stop-position=468 -d zabbix /var/lib/mysql/mysql-bin.00000*>/home/092701.sql
我的阿里云优惠券地址:
https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=3ow2kbko