如何讀MySQL二進制記錄文件(BinLog)與mysqlbinlog

假設管理員在my.cny配置文件,不失去能力也不評論「日誌容器」參量MySQL數據庫服務器引起二進制記錄文件為每種交易對數據庫。 二進制記錄文件在二進制格式被寫。 雖然雙日誌或者亦稱logbin為MySQL數據庫複製目的主要使用,您可能有時需要審查或讀雙內容登錄文本格式, mysqlbinlog公共事業將遲早有用。

不可能立刻打開二進制記錄文件,通常有名字以格式host_name-bin.xxxxxx和商店在/var/lib/mysql目錄,和讀,當它以不值一讀的二進制格式。 要讀雙登錄文本格式,我們能利用mysqlbinlog命令,也能對一臺奴隸服務器寫的readrelay記錄文件在複製設定。 中轉日誌有格式和二進制記錄文件一樣。

要使用mysqlbinlog公共事業是簡單的,簡單地使用以下命令句法在註冊以後祈求mysqlbinlog作為根(您必須指定用戶名和密碼)通過SSH轟擊:

mysqlbinlog [選擇] log_file…

如此讀和顯示二進制記錄文件的內容命名了binlog.000001,使用這個命令:

mysqlbinlog binlog.000001

二進制記錄文件和它的數據可能是非常巨大的,因而使它幾乎不可能讀任何東西在屏幕。 然而,您能用管道輸送mysqlbinlog產品入可以是為以後瀏覽開放在文本編輯程序,通過使用以下命令的文件:

mysqlbinlog binlog.000001 > filename.txt

要減少從二進制日誌檢索的相當數量數據,有可以用於限制數據返回的幾個選擇。 在有用部分之中如下是列出的:

- start-datetime=datetime

比日期-時間的論據開始讀二進制日誌在第一個事件有時間戳相等對或更晚。 日期-時間的價值是相對當地時區在機器,您跑mysqlbinlog。 價值應該以為日期-時間或時間戳接受的格式數據類型。 例如:

mysqlbinlog --start-datetime= " 2005-12-25 11:25 :56 " binlog.000001

- stop-datetime=datetime

停止讀二進制日誌在第一個事件有時間戳均等或後部到日期-時間的論據。 這個選擇為此刻補救是有用的。 看-開始日期-時間的選擇的描述對於關於日期-時間的價值的信息。

- start-position=N

開始讀二進制日誌在第一個事件有位置相等與N論據。 This option applies to the first log file named on the command line.

–stop-position=N

Stop reading the binary log at the first event having a position equal or greater than the N argument. This option applies to the last log file named on the command line.

For more usage information on mysqlbinlog, visit here.

IMPORTANT: This is a machine translated page which is provided "as is" without warranty. Machine translation may be difficult to understand. Please refer to original English article whenever possible.

Share and contribute or get technical support and help at My Digital Life Forums.



One Response to “How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog”

  1. Pisu
    June 29th, 2008 16:33
    1

    This post saved my life today… when the binary log were the only way to retrieve important data get lost… thanks!!

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

mysqlbinlog - BINLOG - mysql binary log - mysql logs - mysql binlogs - read mysql logs - mysql log file - mysql log reader - mysql log files - read mysql log - reading mysql logs - mysql binary logs - how to read mysql log - mysql read bin log - mysql log read - mysql binary log reader - mysql binlog format - mysql binlog - mysql bin log reader - mysql binary log files - binlog mysql - mysql binlog reader - mysqlbinlog example - mysql read log - read mysql bin log - mysql bin log - binary log - read binlog - mysql binary logging - mysql log format - mysqlbinlog usage - mysql binary log format - mysql bin log export - binlogs in mysql - mysqlbinlog - mysql binary - how to read mysql bin log - mysql logging - mysql binary log location - mysql log files windows - reading mysql bin logs - how to read mysql binary log - mysql read logs - how to read mysql log file - tool read mysql binlog file - mysqlbinlog windows - logs mysql - change binlog position - mysql bin - mysql bin read -