查询binlog
#查询是否开启binlogshow variables like '%log_bin%'#查看binlog模式(row,statement,mixed)show variables like 'binlog_format%'; #开启binlog和设置bin日志大小,在my.cnf里[mysqld]中添加log-bin=mysql-binmax_binlog_size=512M
binlog解析导出
#导出某个时间段的数据mysqlbinlog --start-datetime='2017-11-10 00:00:00' --stop-datetime='2017-11-13 14:31:00' /alidata/server/mysql/data/mysql-bin.000011 >> ./now.sql#使用-d 可选择数据库#在阿里云的RDS下载的binlog文件,解析之后,文件里会显示类似乱码:BINLOG 'GYcEXBNQ1H0xXAAAABIcqQMAAFgAAAAAAAEACm1lc3MtY2xvdWQADHRfdXNlcl9sb2dpbgAPCAgIDw8PDw8PEREBAREREMgAkAHIAMgAyADIAAAAAAD+H0edjVg=GYcEXBhQ1H0xdgEAAIgdqQMAAFgAAAAAAAEAD/8QgCMpAAAAAAAAIykAAAAAAAAPAAAAAAAAAAQwMDExBDAwMTEocVdISVlsZ0FzSFNHbW5ldHNOQUdreURZak5EQ2NJVnh3dGNwYUhBVihmYWM0YzU3NjVhYjI4ODBlMGQ0NzU3YjhkNDY5ZDU3ZGIwMjNkNTIxIGU4YmJjY2RkNzA2YjViNDFhYjU0Njk4NmVlMGUyMTExXAh4sVwEhDEBAViFXoZcBIQwEIAjKQAAAAAAACMpAAAAAAAADwAAAAAAAAAEMDAxMQQwMDExKHFXSElZbGdBc0hTR21uZXRzTkFHa3lEWWpORENjSVZ4d3RjcGFIQVYoZmFjNGM1NzY1YWIyODgwZTBkNDc1N2I4ZDQ2OWQ1N2RiMDIzZDUyMSBmYTQwZDFhYWI0MDdjMmY4NzBlODM2YzRjY2ZiMzBhZFwIe5pcBIcaAQFYhV6GXASHGcIVSN4='/*!*/;#需要增加--base64-output=decode-rows 参数