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 ולאחסן in / var / lib / mysql directory, לא היתה אפשרות לפתוח ולקרוא מיד כמו זה בתבנית בינארית בלתי קריא. 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 היא פשוטה, פשוט להשתמש בתחביר הפקודה הבאה כדי להפעיל mysqlbinlog לאחר הכניסה כפי שורש (אחרת אתה צריך לציין שם משתמש וסיסמה) להפגיז דרך SSH:

mysqlbinlog [options] 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

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

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-datetime = datetime

Start reading the binary log at the first event having a timestamp equal to or later than the datetime argument. להתחיל לקרוא את יומן בינארית באירוע הראשון לאחר חותמת זמן שווה או מאוחר יותר את טענת datetime. 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. הערך צריך להיות בתבנית המקובלת עבור DateTime או סוגי נתונים Timestamp. For example: לדוגמה:

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

–stop-datetime=datetime -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. אפשרות זו שימושית עבור נקודה ב-זמן ההתאוששות. See the description of the –start-datetime option for information about the datetime value. לראות את התיאור של האפשרות-datetime להתחיל לקבל מידע על הערך datetime.

–start-position=N -Start-N = מיקום

Start reading the binary log at the first event having a position equal to the N argument. להתחיל לקרוא את יומן בינארית באירוע הראשון אחרי עמדה שווה את טענת נ. This option applies to the first log file named on the command line. אפשרות זו חלה על היומן הראשון קובץ בשם בשורת הפקודה.

–stop-position=N -Stop-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 : The page is machine translated and provided "as is" without warranty. חשוב: הדף מכונת תירגם מתפרסם "כמות שהוא" ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to נא עיין original English article המאמר המקורי באנגלית whenever possible. בכל הזדמנות אפשרית.


2 Responses to “How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog” 2 תגובות ל "כיצד קרא MySQL בינארי התחבר קבצים (BinLog) עם mysqlbinlog"

  1. nicolas ניקולה
    September 5th, 2009 05:04 5 ספטמבר 2009 05:04
    2 2

    don't forget (as i did) to execute mysqlbinlog with a user that has permission to read the binlog or sudo works nicely too. לא לשכוח (כמוני) לבצע mysqlbinlog עם משתמש שיש לו הרשאה לקרוא את binlog או sudo עובד יפה מדי.

  2. Pisu Pisu
    June 29th, 2008 16:33 29 יוני 2008 16:33
    1 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> באפשרותך להשתמש בתגים אלה: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. כדי להירשם הערות תכונה הושבת. To receive notification of latest comments posted, subscribe to כדי לקבל הודעה העדכנית של תגובות, כדי להירשם My Digital Life Comments RSS feed החיים שלי דיגיטליות תגובות RSS Feed or או register to receive הרשמה לקבלת new comments in daily email digest. תגובות חדש ב דוא"ל תקציר יומי.
Custom Search

New Articles מאמרים חדשים

Incoming Search Terms for the Article תנאי נכנסות חיפוש עבור מאמרים

mysql binary log יומן בינארית MySQL - -- mysqlbinlog command הפקודה mysqlbinlog - -- mysqlbinlog mysqlbinlog - -- binlog mysql MySQL binlog - -- mysql bin log reader יומן בן MySQL הקורא - -- reader mysql binary log יומן קורא בינארי MySQL - -- reading mysql-bin logs MySQL יומני קריאה סל - -- view mysql binary log יומן תצוגה בינארית MySQL - -- view mysql bin-log סל להציג MySQL-log - -- windows mysqlbinlog Windows mysqlbinlog - -- BINLOG BINLOG - -- mysql binary log view תצוגת יומן MySQL בינארית - -- mysql transaction log view יומן הטרנזקציות MySQL נוף - -- binlog database upgrade שדרוג מסד הנתונים binlog - -- how to read binary text איך לקרוא טקסט בינארי - -- how to read from mysql איך לקרוא מתוך MySQL - -- how to read mysql binary logs איך לקרוא את יומני בינארית MySQL - -- log mysql-bin יומן MySQL סל - -- mysql read bin logs MySQL לקרוא את יומני בן - -- mysqlbinlog ubuntu examples mysqlbinlog דוגמאות Ubuntu - -- mysql reading transaction log העסקה MySQL יומן קריאה - -- mysql bin logs יומני בן MySQL - -- MySQL+reading binary logs MySQL + יומני קריאה בינארית - -- mysql search binary log יומן חיפוש בינארי MySQL - -- mysql read bin log file הקובץ לקרוא יומן סל MySQL - -- mysql binlog programming interface ממשק תכנות MySQL binlog - -- mysql bin log viewer יומן בן MySQL הצופה - -- mysqlbinlog howto Howto mysqlbinlog - -- mysql binlogs binlogs MySQL - -- mysql binlog viewer הצופה binlog MySQL - -- mysqlbinlog usage השימוש mysqlbinlog - -- mysqlbinlog error relay log ממסר שגיאה mysqlbinlog יומן - -- mysql log viewer הצופה יומן MySQL - -- mysql-bin analyze MySQL סל לנתח - -- MySQLBinlog.java+samples MySQLBinlog.java + דוגמאות - -- read mysql bin log to a file לקרוא יומן סל MySQL לקובץ - -- read mysql binary log לקרוא יומן MySQL בינארית - -- view mysql log יומן להציג MySQL - -- viewing mysql binary logs הצגת היומנים בינארית MySQL - -- binlogs howto binlogs Howto - -- examine mysql-bin לבחון bin-MySQL - -- hot to read mysql error log חם לקרוא יומן שגיאה MySQL - -- How would you get a listing of all binary log files? איך היית מקבל רשימה של כל קובצי יומן בינארית? - -- how to read binlog איך לקרוא binlog - -- how to read mysql query log איך לקרוא את יומן שאילתת MySQL - -- how to read from msql איך לקרוא msql - -- mssql read bin file קובץ bin לקרוא MSSQL - -- mysql logfile command הפקודה קובץ היומן MySQL - -- mysql-bin files MySQL סל קבצים - -- mysql binary log viewer הצופה יומן MySQL בינארית - --