1、查看远程服务器上的二进制日志文件:这里
mysqlbinlog -R -h192.168.1.101 -uroot -p123456 mysql-bin.000036 >
2、指定位置点。start <= pos < end
3、指定时间。
4、
mysqlbinlog --base64-output=DECODE-ROWS -v -v mysql-bin.000776|less
# 那么能否看到原始SQL语句呢?答案是可以,但是必须设置系统变量binlog_rows_query_log_events
mysql> show variables like 'binlog_rows_query_log_events';
+------------------------------+-------+
| Variable_name | Value |
+------------------------------+-------+
| binlog_rows_query_log_events | OFF |
+------------------------------+-------+
1 row in set (0.00 sec)
mysql> set binlog_rows_query_log_events=1;
Query OK, 0 rows affected (0.00 sec)
mysql> flush logs;
Query OK, 0 rows affected (0.01 sec)
mysql> show master status;
+----------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+----------------------+----------+--------------+------------------+-------------------+
| DB-Server-bin.000026 | 120 | | | |
+----------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
mysql>