# grep log-bin my.cnf log-bin = /data/3306/mysql-bin
mysql>show variables like 'log_bin';
二、Mysqlbinlog解析工具mysql
參數 | 描述 |
-d | 指定庫的binlog |
-r | 至關於重定向到指定文件 |
--start-position--stop-position | 按照指定位置精確解析binlog日誌(精確),如不接--stop-positiion則一直到binlog日誌結尾 |
--start-datetime--stop-datetime | 按照指定時間解析binlog日誌(模糊,不許確),如不接--stop-datetime則一直到binlog日誌結尾 |
#mysqlbinlog -d ceshi mysql-bin.000003 -r my.sql
#mysqlbinlog mysql-bin.000003 --start-position=100 --stop-position=200 -r my.sql
四、MySQL企業binlog模式的選擇sql
mysql>show global variables like "binlog%"; +-----------------------------------------+-----------+ | Variable_name | Value | +-----------------------------------------+-----------+ | binlog_cache_size | 1048576 | | binlog_direct_non_transactional_updates | OFF | | binlog_format | STATEMENT | #系統默認爲STATEMENT模式 | binlog_stmt_cache_size | 32768 | +-----------------------------------------+-----------+ 4 rows in set (0.00 sec)
mysql>set global binlog_format='ROW';
#vim my.cnf [mysqld] binlog_format='ROW' #放在mysqld模塊下面 user = mysql port = 3306 socket = /data/3306/mysql.sock
#mysqlbinlog --base64-output="decode-rows" -v mysql-bin.000001