How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog Kaip skaityti MySQL dvejetainių Prisijungti Failai (BinLog) su 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 duomenų bazių serveris generuoja dvejetainių failų kiekvienas sandoris, duomenų bazių, jei administratorius nėra išjungti arba komentaras iš "log-bin" parametras my.cny konfigūracijos failą. The binary log files are written in binary format. Dvejetainių failų yra įrašyti dvejetainiu formatu. 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. Nors dvejetainis, žurnalų ar taip pat žinomas kaip logbin daugiausia naudoja MySQL duomenų bazės replikacija tikslu, kartais jums gali prireikti ištirti, ar skaityti dvejetainiai Įrašai teksto forma, turinys, jei mysqlbinlog naudingumas bus naudinga.
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. Binary failą, kuris paprastai pavadinimo formatas host_name-bin.xxxxxx ir laikyti in / var / lib / mysql katalogas, negali būti pradėtos ir skaityti iš karto, kaip jis yra neįskaitomas dvejetainiu formatu. 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. Skaityti dvejetainis Įrašai tekstiniu formatu, galima naudoti mysqlbinlog komandą, kuri taip pat galėtų readrelay failus parašyta vergas serverio replikacijos setup. Relay logs have the same format as binary log files. Relay Įrašai turi tą patį formatą, kaip dvejetainių failų.
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: Norėdami naudoti mysqlbinlog naudingumas yra labai paprasta, tiesiog naudokite šią komandą sintaksė remiasi mysqlbinlog po prisijungęs kaip root (dar turite nurodyti vartotojo vardą ir slaptažodį), "Shell per SSH:
mysqlbinlog [options] log_file ...
So to read and display the contents of the binary log file named binlog.000001, use this command: Taigi, skaityti ir rodyti dvejetainis žurnalo turinį failo pavadinimą binlog.000001, naudokite šią komandą:
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. Binary failus ir jo duomenys gali būti labai didelis, todėl beveik neįmanoma perskaityti kas ant ekrano. 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: Tačiau galite vamzdelių iš mysqlbinlog į failą, kurį galima atidaryti vėliau Browse teksto redaktoriumi, naudojant šią komandą galia:
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. Norėdami sumažinti duomenų Gauta iš dviejų komponentų Įrašai sumą, yra keletas galimybių, kurios gali būti naudojamos siekiant apriboti duomenų, kad tai buvo grąžinti. Among the useful ones are listed below: Tarp naudinga yra išvardijami toliau:
–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. Pradėti skaityti dvejetainis Prisijungti prie pirmojo įvykio TIMESTAMP lygi arba vėlesnė nei datetime argumentas. The datetime value is relative to the local time zone on the machine where you run mysqlbinlog. Datetime vertė, palyginti su vietos laiko juostą į mašiną, kur paleisti mysqlbinlog. The value should be in a format accepted for the DATETIME or TIMESTAMP data types. Vertė turi būti formatas priimtinas DATETIME arba TIMESTAMP duomenų tipai. For example: Pavyzdžiui
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. Stop Reading binary Prisijungti prie pirmojo įvykio TIMESTAMP lygi arba užpakalinės į datetime argumentas. This option is useful for point-in-time recovery. Ši parinktis yra naudinga, point-in-time išieškojimo. See the description of the –start-datetime option for information about the datetime value. Žr-start-datetime galimybe informacijos apie datetime vertės aprašymas.
–start-position=N -Start-position = N
Start reading the binary log at the first event having a position equal to the N argument. Pradėti skaityti binary log ne pirmas renginys, kurio pozicija lygus N argumentas. This option applies to the first log file named on the command line. Ši galimybė taikoma iki pirmojo žurnalo failo pavadinimą į komandų eilutę.
–stop-position=N -Stop-position = N
Stop reading the binary log at the first event having a position equal or greater than the N argument. Stop Reading binary log ne pirmas renginys, kurio pozicija yra lygi arba didesnė nei N argumentas. This option applies to the last log file named on the command line. Ši galimybė taikoma iki paskutinės žurnalo failo pavadinimą į komandų eilutę.
For more usage information on mysqlbinlog, visit Norėdami gauti daugiau informacijos apie naudojimąsi mysqlbinlog, apsilankykite here čia . .
IMPORTANT : The page is machine translated and provided "as is" without warranty. DĖMESIO: Šis puslapis yra mašina išvertė ir pateikiama "kaip yra" be garantijų. Machine translation may be difficult to understand. Automatinis vertimas gali būti sunku suprasti. Please refer to Remkitės original English article originalas anglų straipsnis whenever possible. jei įmanoma.
Related Articles Susiję straipsniai
- Reset the Root Password of MySQL Server Atstatyti slaptažodį root MySQL Server
- Change and Reset MySQL root Password Kaitos ir naujo MySQL root Password
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial Kaip Backup and Restore (eksportas ir importas) MySQL duomenų bazės Susipažinkite
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 3 Diegimas web serveris FreeBSD 6,0 su Apache 2.2, MySQL 5.0, PHP 5 - 3 dalis
- Read It Later Skaityti vėliau
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 5 Diegimas web serveris FreeBSD 6,0 su Apache 2.2, MySQL 5.0, PHP 5 - 5 dalis
- Disable Auto Go To (Jump) To Read More Tag Išjungti automatinį Go To (Jump) Skaityti daugiau Tag
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 4 Diegimas web serveris FreeBSD 6,0 su Apache 2.2, MySQL 5.0, PHP 5 - 4 dalis
- Encouraging Toddlers to Read with LeapFrog's Tag Junior Pal Skatinti kitomis kalbomis, kad skaityti peršokti's tag Junior Pal
- Check and Optimize MySQL Database Automatically with Crontab/Cron Patikrinti ir optimizuoti MySQL duomenų bazė automatiškai crontab / cron










































September 5th, 2009 05:04 Rugsėjis 5, 2009 05:04
don't forget (as i did) to execute mysqlbinlog with a user that has permission to read the binlog or sudo works nicely too. Nepamirškite (kaip aš) atlikti mysqlbinlog su vartotojo, kuris turi leidimą skaityti binlog arba sudo darbai gražiai per.
June 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!! Ši žinutė išgelbėjo mano gyvenimą šiandien ... kai binary Prisijungti buvo vienintelis būdas susigrąžinti svarbius duomenis pasiklysti ... Thanks!