• 获取binlog文件列表
show binary logs;

WX20200401-173451@2x

  • 查看当前正在写入的binlog文件
show master status
  • 查看指定binlog文件的内容
show binlog events in 'mysql-bin.000002';
  • 查看binlog具体内容
mysqlbinlog -u temp_admin  -h psi.mysql.test.tcit.cc -P 3306 --read-from-remote-server -p  --base64-output="decode-rows" -v  --start-datetime='2020-04-01 14:00:00' --stop-datetime='2020-04-01 16:00:00'  mysql-bin.000030 > xxx.txt

如果无base64-output="decode-rows" 获取到的sql是加密的