How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog MySQLのバイナリログファイルを読む方法について( binlogへ)をmysqlbinlogに
MySQL database server generates binary log files for every transaction to the databases, provided administrator does not disable or comment out the “log-bin” parameter in my.cny configuration file. MySQLデータベースサーバのログファイルを生成するバイナリのデータベースのすべてのトランザクションを、管理者に提供されませんを無効にするかをコメントアウトして"ログ-ビン"のパラメータにmy.cnyの設定ファイルです。 The binary log files are written in binary format.バイナリログファイルは、バイナリ形式で書かれています。 Although the binary logs, or also known as logbin are mainly used for MySQL database replication purpose, sometimes you may need to examine or read the contents of binary logs in text format, where the mysqlbinlog utility will come in handy.は、バイナリログか、またはとしても知られlogbin mysqlデータベースのレプリケーションは、主に使用される目的のために、時にはを検討する必要がありますまたはバイナリログの内容を読んでテキスト形式で、ここでは、 mysqlbinlogユーティリティは重宝する。
Binary log file, which normally has name with the format host_name-bin.xxxxxx and store in /var/lib/mysql directory, could not be opened and read straight away as it’s in unreadable binary format.バイナリログファイルは、通常の形式は、名前をhost_nameの- bin.xxxxxxとストアでに/ var / lib / mysqlディレクトリ、開くことができませんでしたを読んですぐに読み取れないのバイナリ形式です。 To read the binary logs in text format, we can make use of mysqlbinlog command, which also able to readrelay log files written by a slave server in a replication setup.バイナリログを読むにはテキスト形式で、私たちにmysqlbinlogコマンドも使用できるように、これもできるように書かれたreadrelayスレーブサーバのログファイルに、複製のセットアップを実行します。 Relay logs have the same format as binary log files.リレーログは、同じ形式のバイナリログファイルです。
To use mysqlbinlog utility is simple, simply use the following command syntax to invoke mysqlbinlog after login in as root (else you have to specify user name and password) to shell via SSH: mysqlbinlogユーティリティを使用するは、簡単で、単純には、以下のコマンドの構文を起動するには、 rootとしてログインした後にmysqlbinlog (他には、ユーザー名とパスワードを指定する)をssh経由でシェル:
mysqlbinlog [options] log_file … mysqlbinlogに[オプション] log_file …
So to read and display the contents of the binary log file named binlog.000001, use this command:これを読むと、バイナリログの内容を表示するにbinlog.000001という名前のファイルを使うと、このコマンド:
mysqlbinlog binlog.000001 mysqlbinlogにbinlog.000001
The binary log files and its data are likely to be very huge, thus making it almost impossible to read anything on screen.バイナリログファイルとそのデータが予想される非常に巨大な、このように何かを読むことがほとんど不可能を画面に表示する。 However, you can pipe the output of mysqlbinlog into a file which can be open up for later browsing in text editor, by using the following command:しかし、パイプの出力をすることができます。 mysqlbinlogにこれをファイルにブラウズできる開放へのテキストエディタを使用して、次のコマンド:
mysqlbinlog binlog.000001 > filename.txt mysqlbinlogにbinlog.000001 > filename.txtと
To reduce the amount of data retrieved from binary logs, there are several options that can be used to limit the data that is been returned.量を減らすには他の項目からのデータをバイナリログには、いくつかのオプションを制限するために使われることができるデータが返されています。 Among the useful ones are listed below:間の有用なものは次のとおりです:
–start-datetime=datetime スタート-日時=日時
Start reading the binary log at the first event having a timestamp equal to or later than the datetime argument.スタート]ボタンを読んでバイナリログの最初のイベントのタイムスタンプに等しい持つまたはそれ以降の引数日時よりです。 The datetime value is relative to the local time zone on the machine where you run mysqlbinlog. datetimeの値が相対的にされているマシンのローカルタイムゾーンにmysqlbinlogを実行する場所です。 The value should be in a format accepted for the DATETIME or TIMESTAMP data types.の値のフォーマットの受け入れを実施すべきであるが、日時やタイムスタンプのデータ型です。 For example:例えば:
mysqlbinlog --start-datetime="2005-12-25 11:25:56" binlog.000001 mysqlbinlogに-開始日時= " 2 005-12-251 1時2 5分5 6秒" b inlog.000001
–stop-datetime=datetime -停止-日時=日時
Stop reading the binary log at the first event having a timestamp equal or posterior to the datetime argument.読むのを止めて、バイナリログの最初のイベントで同額後のタイムスタンプを持つdatetimeアーギュメントです。 This option is useful for point-in-time recovery.このオプションは、お役にたちました- in - timeリカバリをポイントします。 See the description of the –start-datetime option for information about the datetime value.詳細については、説明書をスタート- datetimeオプションの詳細については、 datetime値です。
–start-position=N スタートポジション= n
Start reading the binary log at the first event having a position equal to the N argument.スタート]ボタンを読んでバイナリログの最初のイベントがある地位のnの引数に等しいです。 This option applies to the first log file named on the command line.このオプションが適用さ、最初のコマンドライン上でログファイルの名前です。
–stop-position=N 停止位置= n
Stop reading the binary log at the first event having a position equal or greater than the N argument.読むのを止めて、バイナリログの位置の最初のイベントに等しいかそれ以上のnの引数です。 This option applies to the last log file named on the command line.このオプションが適用さログファイルの最後のコマンドライン上で名づけています。
For more usage information on mysqlbinlog, visit mysqlbinlogには他の利用方法については、下記のをご覧 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 私のデジタルライフフォーラム .です。
Related Articles関連記事
- Change or Set MySQL Long Query Time Value for log-slow-queries MySQLの長いクエリを変更または時間の値を設定することもできます。クエリが遅い
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Databaseログを有効に遅いクエリ(スロークエリログ)にMySQLのデータベースの
- How to Backup and Restore (Export and Import) MySQL Databases Tutorialどのようにバックアップと復元(エクスポートおよびインポート) MySQLデータベースのチュートリアル
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 1ウェブサーバーでは、 Windows XPをインストールするのApache2 、 PHP5とmysql4 -第1部
- Reset the Root Password of MySQL ServerルートのパスワードをリセットしてMySQLサーバ
- MySQL Database Performance Tuning Best Practices Video Tutorial MySQLデータベースのパフォーマンスチューニングのベストプラクティスのビデオチュートリアル
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 FreeBSDの6.0をインストールするWebサーバーのApache 2.2 、 MySQL 5.0以降およびPHP 5 -パート3
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4ウェブサーバーでは、 Windows XPをインストールするのApache2 、 PHP5とmysql4 -パート4
- Change and Reset MySQL root Password MySQLのrootのパスワードを変更し、リセット
- How to Find and Replace Text in MySQL Database using SQL内のテキストを置換する方法を検索し、 MySQLデータベースを使用してのSQL

































June 29th, 2008 16:33 2008年6月29日16:33
This post saved my life today… when the binary log were the only way to retrieve important data get lost… thanks!!この投稿を保存したときに私の人生の今日…バイナリログは、重要なデータを取得する唯一の方法で道に迷う…ありがとう! !