Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't read mysql binary log

When I try to view a binary log file on my Free BSD server (/var/lib/mysql/ib_logfile0) with mysqlbinlog using the following command:

I get the error "File is not a binary log file."

$ sudo mysqlbinlog -f ib_logfile0 > ib_0.sql

After that, ib_0.sql contains:

{ /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ERROR: File is not a binary log file }

I've verified that it is a binary file and I have read there is a possibility that file is an innodb log file. Anyway, I can't read that file and I don't find any solution. Is there another way to view this file?

like image 644
user1173837 Avatar asked Jan 31 '12 12:01

user1173837


People also ask

How do I read MySQL binary logs?

You can use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. You can also read binary logs from a remote server by using the --read-from-remote-server option. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server.

How do I enable MySQL binary log?

Enabling the binary logs MySQL binary logs can be enabled or disabled by adding or removing the log-bin configuration option. The log-bin parameter is in the configuration files named my. ini. When we install MySQL Server, the configuration file is created in C:\ProgramData\MySQL\MySQL Server 8.0 directory.

How do I view MySQL transaction logs?

The transaction log in MySQL is not enabled by default and must be enabled in order to log transactions. To determine if the transaction log is active you can use the “show binary logs” statement: SHOW BINARY LOGS; If binary logging is disabled you will receive an error stating “you are not using binary logging”.

What is binary log file in MySQL?

The binary log is a set of log files that contain information about data modifications made to a MySQL server instance. The log is enabled by starting the server with the --log-bin option. The binary log was introduced in MySQL 3.23. 14. It contains all statements that update data.


1 Answers

Same question here - but I found an answer. These are transaction logs, not query logs, that are not for human consumption.

like image 179
cdonner Avatar answered Oct 04 '22 00:10

cdonner