How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog كيف تقرأ ثنائي الخلية ملفات الدخول (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. الخلية يولد ثنائي خادم قاعدة البيانات عن كل ملفات الدخول إلى قواعد البيانات والمعاملات ، وقدمت مدير البرنامج لا تعطيل أو تعليق من اصل "دخول - بن" 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 وهي تستخدم أساسا لقاعدة بيانات الخلية تكرار الغرض ، وفي بعض الاحيان قد تحتاج الى دراسة أو قراءة محتويات سجلات ثنائي في شكل النص ، حيث 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 وتخزينها فى / فار / ليب / الخلية دليل ، ولا يمكن قراءة وفتح على الفور كما انه شكل ثنائي في قراءتها. 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 … 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 - بدء 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 او الزمني للانواع البيانات. For example: فعلى سبيل المثال :
mysqlbinlog --start-datetime="2005-12-25 11:25:56" binlog.000001 mysqlbinlog -- بداية - datetime = "2005-12-25 11:25:56" binlog.000001
–stop-datetime=datetime - وقف - 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 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 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 لمزيد من المعلومات عن الاستخدام 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 تغيير الخلية او مجموعة طويلة وقت الاستعلام عن قيمة الدخول بطيء الاستفسارات
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database تمكن من قطع الاشجار بطيءه الاستفسارات (بطيءه سجل استفسار) في قاعدة بيانات الخلية
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial كيفية النسخ الاحتياطي واستعادة (الصادرات والواردات) الخلية قواعد البيانات الدورة التعليميه
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 1 تثبيت خادم الويب في ويندوز اكس بي مع apache2 ، php5 وmysql4 -- الجزء 1
- Reset the Root Password of MySQL Server اعادة ضبط كلمة السر من الجذر الخلية الخادم
- MySQL Database Performance Tuning Best Practices Video Tutorial قاعدة بيانات الخلية ضبط اداء افضل الممارسات الدورة التعليميه الفيديو
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 تركيب خادم الويب مع 6،0 في فري بي. اس. دي اباتشي 2،2 ، 5،0 الخلية وبي. اتش. بى 5 -- الجزء 3
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 تثبيت خادم الويب في ويندوز اكس بي مع apache2 ، php5 وmysql4 -- الجزء 4
- Change and Reset MySQL root Password تغيير الخلية الجذريه واعادة ضبط كلمة السر
- How to Find and Replace Text in MySQL Database using SQL وكيفية العثور على استبدال نص في الخلية قاعدة البيانات باستخدام لغة الاستعلامات البنيويه
























June 29th, 2008 16:33 يونيو 29th ، 2008 16:33
This post saved my life today… when the binary log were the only way to retrieve important data get lost… thanks!! هذا انقذ حياتي بعد اليوم… عندما سجل ثنائية التركيب ، وكانت الطريقة الوحيدة لاسترجاع البيانات المهمة تضيع… شكرا!!