How to convert mysql bin-log log files to sql files

How to convert mysql bin-log log files to sql files

View mysqlbinlog version

mysqlbinlog -V [--version]

Check the binlog log opening status

show variables like '%log_bin%';

After MySQL opens the bin-log log, non-query operations of the MySQL database will save records in the bin-log file. Generally, bin-log log files cannot be opened for viewing and require the use of mysql tools. Assume that the binary file mysql-bin.000011 is stored in the /mysql/data/ directory. You need to export the SQL statements about the database tide in the log file mysql-bin.000011 to the file tide.sql. Perform the following operations:

// Export the SQL statements about the tide database from the binlog file to the file mysqlbinlog mysql-bin.000011 -d tide > tide.sql 
// Select a time range to export mysqlbinlog --start-date="2017-08-12 15:00:19" --stop-date="2017-08-12 15:30:19" mysql-bin.000011 -d tide > tide.sql

If the binlog log file is recorded in ROW format

// Parse the row-format binlog log file into a base64 file. -v represents line break display. mysqlbinlog --base64-output=decode-rows -v mysql-bin.000011 -d tide > tide.sql

After execution, a tide.sql file will be generated in the current directory. You can use vim/vi to open the file.

Summarize

The above is the method that the editor introduced to you how to convert MySQL bin-log log files into sql files. I hope it will be helpful to you!

You may also be interested in:
  • Analysis and solution of a MySQL slow log monitoring false alarm problem
  • The role and opening of MySQL slow query log
  • Enabling and configuring MySQL slow query log
  • Detailed explanation of the binlog log analysis tool for monitoring MySQL: Canal
  • Detailed explanation of MySQL redo log (redo log) and rollback log (undo logo)
  • Analysis of MySQL Aborted connection warning log
  • Detailed explanation of MySQL transactions and MySQL logs
  • A detailed introduction to the construction and use of the tool Anemometer graphically displays MySQL slow logs
  • Detailed explanation of the reason why the MySQL 5.7 slow query log time is 8 hours behind the system time
  • Summary of MySQL log related knowledge

<<:  Sample code for implementing PC resolution adaptation in Vue

>>:  VScode Remote SSH remote editing and debugging code

Recommend

How to make full use of multi-core CPU in node.js

Table of contents Overview How to make full use o...

Implementation steps for building multi-page programs using Webpack

It is very common to use webpack to build single-...

Tutorial on installing AutoFs mount service under Linux

Whether it is Samba service or NFS service, the m...

How to implement page jump in Vue project

Table of contents 1. Create a vue-cli default pro...

Differences between FLOW CHART and UI FLOW

Many concepts in UI design may seem similar in wo...

Manually install mysql5.7.10 on Ubuntu

This tutorial shares the process of manually inst...

Summary of things to pay attention to in the footer of a web page

Lots of links You’ve no doubt seen a lot of sites ...

jQuery plugin to implement search history

A jQuery plugin every day - to make search histor...

JavaScript pre-analysis, object details

Table of contents 1. Pre-analysis 1. Variable pre...

Implementation code of jquery step progress axis plug-in

A jQuery plugin every day - step progress axis st...

Example of compiling LNMP in Docker container

Table of contents 1. Project Description 2. Nginx...

Specific use of Linux gcc command

01. Command Overview The gcc command uses the C/C...

Sample code using the element calendar component in Vue

First look at the effect diagram: The complete co...

How to use the Linux more command in Linux common commands

more is one of our most commonly used tools. The ...

MySQL 8.0.17 installation and configuration graphic tutorial

This article records the graphic tutorial of MySQ...