Mysql-bin.000001 files are generated and processing methods mysql-bin.000001, mysql-bin.000002 and other files are database operation logs, such as UPDATE a table,
Mysql-bin.000001 files are generated and processing methods mysql-bin.000001, mysql-bin.000002 and other files are database operation logs, such as UPDATE a table,
How to generate mysql-bin.000001 file and its processing method
Files such as mysql-bin.000001, mysql-bin.000002 are database operation logs, such as updating a table, or deleting some data, even if the statement does not match the data, the command is stored in the log file, the execution time of each statement is also recorded.
There are two main purposes to do this:
1. Data Recovery
If there is a problem with your database, and you have had a backup before, you can check the log file to find out which command causes a problem with your database and find a way to recover the loss.
2: synchronize data between master and slave servers
All operations on the master server are recorded in the log. The slave server can follow the log to ensure two synchronization.
There are two solutions:
1: There is only one mysql server. You can simply comment out this option.
Vi/etc/my. cnf comment out the log-bin line and restart the mysql service.
# Replication Master Server (default)
# Binary logging is required for replication
Log-bin = mysql-bin
2: If your environment is a master-slave server, you need to perform the following operations.
A: On each SLAVE server, use show slave status to check which log it is reading.
B: Use SHOW MASTER LOGS to obtain a series of LOGS on the MASTER server.
C: Identify the earliest log among all slave servers. This is the target log. If all slave servers are updated, it is the last log in the list.
D: clear all the logs, but not the target logs, because the slave server needs to synchronize with it.
The log cleanup method is as follows:
Purge master logs to 'mysql-bin.010 ';
Purge master logs before '2017-12-19 21:00:00 ';
If you are sure that the slave server has been synchronized, just like the MASTER server, you can directly RESET the MASTER to delete these files.