vi /etc/my.cnf
server-id=1
binlog_format = mixed
log-bin=/var/lib/mysql/mysql-binlog
expire_logs_days = 7
max_binlog_size = 100m
binlog_cache_size = 4m
max_binlog_cache_size = 512m
重启 service mysqld restart
查询日志
show variables like 'log_%';
show binary logs;
show binlog events in 'mysql-binlog.000002';