How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog Cómo leer MySQL archivos de registro binario (binlog) con 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. Servidor de bases de datos MySQL genera archivos de registro binario para cada transacción a las bases de datos, a condición de administrador no desactivar o comentar el "log-bin" parámetro en my.cny archivo de configuración. The binary log files are written in binary format. Los archivos de registro binario están escritos en formato binario. 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. Aunque los logs binarios, o también conocido como logbin se utilizan principalmente para la replicación de bases de datos MySQL fin, a veces, puede que tenga que estudiar o leer el contenido de logs binarios en formato de texto, donde la utilidad mysqlbinlog vendrá muy bien.

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. Archivo de registro binario, que normalmente tiene el nombre con el formato host_name-bin.xxxxxx y almacenar en / var / lib / mysql directorio, no se puede abrir y leer de inmediato como es ilegible en formato binario. 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. Para leer los logs binarios en formato texto, podemos hacer uso de mysqlbinlog comando, que puede utilizarse también para readrelay archivos de registro por escrito de un servidor esclavo en una configuración de replicación. Relay logs have the same format as binary log files. Relay registros tienen el mismo formato binario como archivos de registro.

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: Para utilizar mysqlbinlog utilidad es muy simple, basta con usar la siguiente sintaxis de comandos para invocar mysqlbinlog después de login en el sistema como root (cosa que usted tiene que especificar el nombre de usuario y contraseña) a través de SSH shell:

mysqlbinlog [options] log_file … mysqlbinlog [opciones] log_file…

So to read and display the contents of the binary log file named binlog.000001, use this command: Así que a leer y mostrar el contenido del archivo de registro binario llamado binlog.000001, utilice este comando:

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. Los binarios y archivos de registro de sus datos es probable que sean muy grandes, por lo que resulta casi imposible de leer nada en la pantalla. 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: Sin embargo, puede tubería de la salida de mysqlbinlog en un fichero que puede abrir más tarde para la navegación en editor de texto, utilizando el siguiente comando:

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. Para reducir la cantidad de datos binarios recuperados de los registros, hay varias opciones que pueden ser utilizados para limitar los datos que se han devuelto. Among the useful ones are listed below: Entre los útiles que se enumeran a continuación:

–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. Empezar a leer el log binario en el primer evento que tenga la fecha igual o posterior a la datetime argumento. The datetime value is relative to the local time zone on the machine where you run mysqlbinlog. El valor datetime es relativo a la zona horaria local en la máquina donde se ejecuta mysqlbinlog. The value should be in a format accepted for the DATETIME or TIMESTAMP data types. El valor debe estar en un formato aceptado para la DATETIME o TIMESTAMP tipos de datos. For example: Por ejemplo:

mysqlbinlog --start-datetime="2005-12-25 11:25:56" binlog.000001 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. Pare leer el log binario en el primer evento que tenga la fecha igual o posterior al argumento datetime. This option is useful for point-in-time recovery. Esta opción es útil para el punto-a-tiempo de recuperación. See the description of the –start-datetime option for information about the datetime value. Véase la descripción de la puesta en marcha de datetime opción para obtener información sobre el valor datetime.

–start-position=N - Start-position = N

Start reading the binary log at the first event having a position equal to the N argument. Empezar a leer el log binario en el primer evento que tenga una posición igual al argumento N. This option applies to the first log file named on the command line. Esta opción se aplica al primer archivo de registro de nombre en la línea de comandos.

–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. Pare leer el log binario en el primer evento que tenga una posición igual o superior al N argumento. This option applies to the last log file named on the command line. Esta opción se aplica a los últimos archivo de registro de nombre en la línea de comandos.

For more usage information on mysqlbinlog, visit Para obtener más información sobre el uso mysqlbinlog, visite here aquí .

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Se trata de una máquina que traduzca la página se proporciona "tal cual" sin garantía. Machine translation may be difficult to understand. La traducción automática puede resultar difícil de entender. Please refer to Por favor, consulte original English article artículo original Inglés whenever possible. siempre que sea posible.

Share and contribute or get technical support and help at Compartir y contribuir o recibir apoyo técnico y ayudar a My Digital Life Forums Mi vida digital Foros .



One Response to “How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog” Una Respuesta a "Cómo leer MySQL archivos de registro binario (binlog) con mysqlbinlog"

  1. Pisu
    June 29th, 2008 16:33 29 de junio de 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!! Este puesto salvado mi vida… hoy cuando el log binario son el único modo de recuperar los datos importantes se pierden… gracias!

Leave a Reply Deja Responder

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> Puede usar estos tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Suscribirse sin comentar


Custom Search

New Articles Nuevos Artículos

Incoming Search Terms for the Article Próximos Términos de búsqueda para el artículo

mysqlbinlog mysqlbinlog - -- BINLOG Binlog - -- mysql logs MySQL registros - -- mysql binary log MySQL registro binario - -- mysql log file MySQL archivo de registro - -- mysql binlogs MySQL binlogs - -- read mysql logs leer logs de MySQL - -- mysql log reader MySQL diario lector - -- mysql log files MySQL archivos de registro - -- mysql binary logs MySQL logs binarios - -- read mysql log leer diario de MySQL - -- mysql binary log reader MySQL registro binario lector - -- mysql binlog MySQL binlog - -- mysql read bin log MySQL leer bin log - -- mysql bin log MySQL bin log - -- reading mysql logs MySQL registros de lectura - -- how to read mysql log cómo leer log de MySQL - -- mysql log read MySQL log leer - -- mysql bin log reader MySQL bin log lector - -- mysql binlog reader MySQL binlog lector - -- mysql read log MySQL leer log - -- mysql binlog format MySQL binlog formato - -- binlog mysql binlog MySQL - -- read mysql bin log leer MySQL bin log - -- mysql binary log format MySQL formato de registro binario - -- mysql read transaction log MySQL leer diario de las transacciones - -- mysql binary log files MySQL archivos de registro binario - -- mysql binary binaria de MySQL - -- mysql binary logging MySQL log binario - -- mysql log format formato de registro de MySQL - -- mysqlbinlog example mysqlbinlog ejemplo - -- mysqlbinlog usage mysqlbinlog uso - -- binary log log binario - -- read binlog leer binlog - -- how to read mysql logs cómo leer los registros de MySQL - -- binlogs mysql binlogs MySQL - -- read mysql binlog leer MySQL binlog - -- reading mysql bin logs MySQL lectura bin registros - -- mysql bin log export MySQL bin registro de exportación - -- binlogs in mysql binlogs en MySQL - -- mysqlbinlog mysqlbinlog - -- how to read mysql bin log cómo leer mysql bin log - -- how to read mysql binlog cómo leer MySQL binlog - -- mysql logging MySQL tala - -- mysql binary log location MySQL registro binario ubicación - -- mysql log files windows MySQL archivos de registro de Windows - -- mysql read log file MySQL leer archivo de registro - -- how to read mysql binary log cómo leer mysql registro binario - -- mysql read bin logs MySQL bin leer logs - -- how to read mysql-bin cómo leer mysql-bin - --