mysqlbinlog把mysql二進位檔案轉換文字檔

來源:互聯網
上載者:User

目前一些項目已經遷移到Mysql5.5,而在mysql5.5中binlog_format為mixed這樣的話,預設情況下的Mysql binary log就是base64格式,不可讀,為了在排查問題時候,提供協助研讀下mysqlbinlog的協助文檔得知可以解碼:

  –base64-output[=name]
Determine when the output statements should be
base64-encoded BINLOG statements: ’never’ disables it and
works only for binlogs without row-based events;
 ’decode-rows’ decodes row events into commented SQL
                      statements if the –verbose option is also given; ’auto’
prints base64 only when necessary (i.e., for row-based
events and format description events); ’always’ prints
base64 whenever possible. ’always’ is deprecated, will be
removed in a future version, and should not be used in a
production system.  –base64-output with no ’name’
argument is equivalent to –base64-output=always and is
also deprecated.  If no –base64-output[=name] option is
given at all, the default is ’auto’.
mysqlbinlog –base64-output=DECODE-ROWS -v mysql-bin.00002

通過給定–base64-output和-v參數,可以解碼row模式下的binary log。

unknown variable ‘default-character-set=utf8mb4′錯誤

一個手機網的項目,使用的編碼為utf8mb4,一切都是正常的。

到了用mysqlbinlog的時候,提示如下:

[root@localhost data]# mysqlbinlog mysql-bin-500.000011
mysqlbinlog: unknown variable ‘default-character-set=utf8mb4′

解決方案:

1. 修改my.cnf,在[client]下注釋或刪除default-character-set=utf8mb4;
2. 在命令列中加入–no-defaults開關,使用mysqlbinlog –no-defaults;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.